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 <[email protected]>
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/
>