I am trying to figure out how to use something like this:
https://docs.jboss.org/author/display/ISPN/CDI+Support#CDISupport-UseaJBossAS7configuredcache
----------------
...
import javax.annotation.Resource;
public class Config {
@Produces
@ApplicationScoped
@Resource(lookup="java:jboss/infinispan/my-container-name")
private EmbeddedCacheManager defaultCacheManager;
}
-------------
The defaultCacheManager part - into either a GuiceModule or an
Interceptor...something along the lines of this project:
https://code.google.com/p/cache4guice/source/browse/trunk/src/org/cache4guice/adapters/infinispan/InfinispanCacheModule.java
So my injector looks something like this:
private static final Injector inj = Guice.createInjector(
new MyGuiceModule(),
new InfinispanCacheModule(null)
);
I have seen some examples of doing a resource lookup in Guice, like this:
public class InfinispanCacheModule extends CacheModule {
...
@Override
protected void configure() {
// bind naming context to the default InitialContext
bind(Context.class).to(InitialContext.class);
bind(CacheContainer.class).toProvider(JndiIntegration.fromJndi(CacheContainer.class,
"java:jboss/infinispan/container/mycachecontainer"));
bindInterceptor(Matchers.any(), Matchers.annotatedWith(Cached.class),
new CacheInterceptor(this));
}
The end goal being the ability to have something like this:
@Cached(cacheName="bigCache")
In order to access bigCache, I need to get the EmbeddedCacheManager via a
resource lookup.
Any help would be greatly appreciated!
--
You received this message because you are subscribed to the Google Groups
"google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-guice?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.