Example shown below is applicable and tested working in JBoss EAP 6.x and JBoss AS 7.x
1. Inject the cache container with @resouce annotation.
a) name, inject with the container name
b) lookup, inject with the jndi name configured in the cache container.
code below is presented with method (a)
make sure the cache container name exist in standalone.xml
else there will be NullPointerException when getting the cache from the cache container.
@Resource(name = "java:jboss/infinispan/container/CACHE-CONTAINER-NAME-IN-STANDALONE.XML")
private CacheContainer container;
make sure the cache container name exist in standalone.xml
else there will be NullPointerException when getting the cache from the cache container.