You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Ilya Kasnacheev <il...@gmail.com> on 2020/02/03 10:58:34 UTC

Re: @SpringResource not injected

Hello!

You have to specify Spring factory when starting Ignite node for injection
to work.

For that, you should start your node with IgniteSpring.start(cfg,
ApplicationContext) methods.

If that does not work, please provide a small reproducer project so that we
could check.

Regards,
-- 
Ilya Kasnacheev


ср, 29 янв. 2020 г. в 13:50, florian.huc <fl...@msci.com>:

> I am trying to create a class:
> public class SecurityPriceDTOStore extends CacheStoreAdapter<Integer,
> SecurityPriceDTO>{
>
> with some resources taken from the Spring context. I tried multiple things
> like:
>
>  @SpringResource(resourceName ="service") public transient String service;
>  @Autowired   @Qualifier("dataSource") public transient MockDataSource
> dataSource;
>
> but no bean is injected. In the method call, if I do search the bean from
> spring context, it is here:
>     context.getBean("service") returns me the expected value.
>
> The store is registered like this:
>     CacheConfiguration secCache = new
> CacheConfiguration("securityPriceCache");
>
> secCache.setCacheStoreFactory(FactoryBuilder.factoryOf(SecurityPriceDTOStore.class));
>
>     List<QueryEntity> l = new ArrayList();
>     l.add(new QueryEntity(Integer.class, SecurityPriceDTO.class));
>     secCache.setQueryEntities(l);
>     secCache.setReadThrough(true);
>     config.setCacheConfiguration(secCache);
>
> Do any one has some idea of why it is failing to inject the beam?
>
> Thanks in advance
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>