title: WildFly 10, JCache - method caching
body: <p>i have simple application using Spring Boot. I wanted allow method caching with JSR107 - JCache. So with help of tutorial i put together this code :</p>
  
  <pre><code>@CacheResult(cacheName = "testpoc")
  public Country getCountry(Integer id){
      System.out.println("---&gt; Loading country with code '" + id + "'");
      return new Country(id, "X", "Title");
  }
  </code></pre>
  
  <p>with this POM file</p>
  
  <pre><code>...
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
          &lt;version&gt;1.4.0.RELEASE&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
           &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
           &lt;artifactId&gt;spring-boot-starter-cache&lt;/artifactId&gt;
           &lt;version&gt;1.4.0.RELEASE&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;javax.cache&lt;/groupId&gt;
          &lt;artifactId&gt;cache-api&lt;/artifactId&gt;
          &lt;version&gt;1.0.0&lt;/version&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  ...
  </code></pre>
  
  <p></p>
  
  <p>(dependency 'spring-boot-starter-web' is there for simple REST service which call <strong>getCountry</strong> method)</p>
  
  <p>Everything works like documentations says - method is invoked only once.</p>
  
  <p><strong>Now i wanted to try it on WildFly 10 application server</strong></p>
  
  <p>I have modified pom file :</p>
  
  <ul>
  <li>excluded tomcat</li>
  <li>exluded spring-boot-starter-cache</li>
  <li>added infinispan-jcache (because i want to use cache configured / managed by wildfly in standalone/domain.xml)</li>
  </ul>
  
  <p>Check pom file <a href="http://pastebin.com/8vMW6Vux" rel="nofollow">here on pastebin</a>.</p>
  
  <p>Problem is, that i am receiving following error :
  <strong>Cannot find cache named 'java:jboss/infinispan/app-cache'</strong></p>
  
  <p>(i have tried to use both JNDI assigned and name to infinispan cache configured in wildfly).</p>
  
  <p>Following code created Cache object (so i can used it) :</p>
  
  <pre><code>CacheManager cacheManager = Caching.getCachingProvider().getCacheManager();
  Cache&lt;String, String&gt; cache = cacheManager.createCache("testpoc", new MutableConfiguration&lt;String, String&gt;());
  </code></pre>
  
  <p><strong>Question</strong> : </p>
  
  <ul>
  <li>It is possible to use JCache method caching on WildFly 10 using Infinispan managed by WildFly ? </li>
  <li>Or Infinispan should be used for method caching like JCache, hence JCache has "more functionality" than Infinispan.</li>
  </ul>
  
  <p>Thank you very much</p>
  
  <p>PS :It is not problem for me to put whole code on github and post link - it is few lines of code ...</p>