Oh, I see now that we are talking about Factory<CacheStoreSessionListener> :) Yes, it looks like a usability issue or even a bug. The implementation should inject dependencies into that factory in the same way it does for CacheStoreFactory. As a workaround, you can try the following:
private CacheConfiguration ipContainerIPV4CacheCfg() { CacheConfiguration ipContainerIpV4CacheCfg = new CacheConfiguration<>(CacheName.IP_CONTAINER_IPV4_CACHE.name()); Factory<IpContainerIpV4CacheLoader> storeFactory = FactoryBuilder.factoryOf(IpContainerIpV4CacheLoader.class); ipContainerIpV4CacheCfg.setCacheStoreFactory(storeFactory); ipContainerIpV4CacheCfg.setCacheStoreSessionListenerFactories(new Factory<CacheStoreSessionListener>() { @Override public CacheStoreSessionListener create() { return new TestCacheStoreSessionListener(); } }); ... } public class TestCacheStoreSessionListener extends CacheJdbcStoreSessionListener { @SpringApplicationContextResource public void setupDataSourceFromSpringContext(Object appCtx) { ApplicationContext appContext = (ApplicationContext) appCtx; setDataSource((DataSource) appContext.getBean("dataSource")); } } Best regards, Slava. чт, 5 июл. 2018 г. в 18:44, Prasad Bhalerao <prasadbhalerao1...@gmail.com>: > > I tried to debug the ignite code, GridResourceProcessor.inject is not >> being executed for injecting resources into CacheStoreSessionListener. It >> is being called for Cachestores. >> >> Can you please advise? >> >> Thanks, >> Prasad >> >> On Thu, Jul 5, 2018 at 8:14 PM Prasad Bhalerao < >> prasadbhalerao1...@gmail.com> wrote: >> >>> I had used SpringApplicationContextResource annotation. But it did not >>> inject the application context in it. So I decided to use spring managed >>> bean and it worked but now it is creating the problem which is described in >>> this mail chain. >>> >>> On Thu, Jul 5, 2018 at 8:11 PM Prasad Bhalerao < >>> prasadbhalerao1...@gmail.com> wrote: >>> >>>> I had used SpringApplicationContextResource annotation. But it did not >>>> inject the application context in it. So I decided to use spring managed >>>> bean and it worked. >>>> >>>> Thanks, >>>> Prasad >>>> >>>> On Thu, Jul 5, 2018 at 7:49 PM Вячеслав Коптилин < >>>> slava.kopti...@gmail.com> wrote: >>>> >>>>> It seems that you need to use @ >>>>> >>>>> SpringApplicationContextResource >>>>> >>>>> instead of @Autowired. >>>>> Could you please check that? >>>>> >>>>> Thanks. >>>>> >>>>> чт, 5 июл. 2018 г. в 17:01, Prasad Bhalerao < >>>>> prasadbhalerao1...@gmail.com>: >>>>> >>>>>> >>>>>> >>>>>> import java.io.Serializable; >>>>>> import javax.cache.configuration.Factory; >>>>>> import javax.sql.DataSource; >>>>>> import org.apache.ignite.IgniteException; >>>>>> import org.apache.ignite.cache.store.CacheStoreSessionListener; >>>>>> import org.apache.ignite.cache.store.jdbc.CacheJdbcStoreSessionListener; >>>>>> import org.springframework.beans.factory.annotation.Autowired; >>>>>> import org.springframework.context.ApplicationContext; >>>>>> >>>>>> public class CacheStoreSessionListenerFactory implements >>>>>> Factory<CacheStoreSessionListener>, Serializable { >>>>>> >>>>>> private static final long serialVersionUID = 6142932447545510244L; >>>>>> >>>>>> private String className; >>>>>> >>>>>> @Autowired >>>>>> private transient ApplicationContext appCtx; >>>>>> >>>>>> >>>>>> public >>>>>> CacheStoreSessionListenerFactory(Class<CacheStoreSessionListener> clazz) >>>>>> { >>>>>> this.className = clazz.getName(); >>>>>> } >>>>>> >>>>>> @Override >>>>>> public CacheStoreSessionListener create() { >>>>>> >>>>>> if (appCtx == null) { >>>>>> throw new IgniteException("Spring application context resource is >>>>>> not injected."); >>>>>> } >>>>>> CacheJdbcStoreSessionListener lsnr = new >>>>>> CacheJdbcStoreSessionListener(); >>>>>> lsnr.setDataSource((DataSource) appCtx.getBean("dataSource")); >>>>>> return lsnr; >>>>>> >>>>>> } >>>>>> >>>>>> } >>>>>> >>>>>> >>>>>> >>>>>> On Thu, Jul 5, 2018 at 7:24 PM slava.koptilin < >>>>>> slava.kopti...@gmail.com> wrote: >>>>>> >>>>>>> Well, the exception is thrown by your class: >>>>>>> org.apache.ignite.IgniteException: Spring application context >>>>>>> resource is >>>>>>> not injected. >>>>>>> at >>>>>>> >>>>>>> *com.qualys.agms.grid.cache.loader.factory.CacheStoreSessionListenerFactory*.create(CacheStoreSessionListenerFactory.java:30) >>>>>>> at >>>>>>> >>>>>>> com.qualys.agms.grid.cache.loader.factory.CacheStoreSessionListenerFactory.create(CacheStoreSessionListenerFactory.java:12) >>>>>>> >>>>>>> Is it possible to share this class as well? >>>>>>> >>>>>>> >>>>>>> >>>>>>> -- >>>>>>> Sent from: http://apache-ignite-users.70518.x6.nabble.com/ >>>>>>> >>>>>>