0 Replies Latest reply on Dec 4, 2015 11:42 AM by alexandre.soares

    Use @Resource on Spring Bean to inject Infinispan CacheContainer

    alexandre.soares

      Hi everyone,

       

      I'm developing a Java application using Jboss EAP 6.4 with Infinispan CACHE. After I configured the Infinispan on standalone-full.xml I started the JBOSS and the Infinispan JNDI was registered ok in jboss configs like below:

       

              <subsystem xmlns="urn:jboss:domain:ee:1.2">
                  <global-modules>
                      <module name="org.infinispan" slot="main"/>
                  </global-modules>
                  <spec-descriptor-property-replacement>false</spec-descriptor-property-replacement>
                  <jboss-descriptor-property-replacement>true</jboss-descriptor-property-replacement>
                  <annotation-property-replacement>false</annotation-property-replacement>
              </subsystem>
      

       

      and...

       

      <subsystem xmlns="urn:jboss:domain:infinispan:1.5">            
           <cache-container name="programasus" default-cache="local" start="EAGER" >
                <local-cache name="local"/>
           </cache-container>
      ...
      

       

      After that I tried to inject the CacheContainer on my Spring Bean:

       

      @Component
      public final class CacheMunicipiosUf {
      
      
        /** The cache. It must configured in Server. */
        @Resource(lookup = "java:jboss/infinispan/container/programasus")
        private CacheContainer cacheContainer;
      
      
      
      

       

      Every time that I deploy that application the CacheContainer is null. Can anyone help me on that? Does anybody know if @Resource works on Spring Bean to locate Infinispan container?