2017-08-02 96 views
0

我試圖在Wilfly 10中使用Infinispan JCache註釋。我的Wildfly安裝有Wildfly-Camel擴展(http://wildfly-extras.github.io/wildfly-camel/ )。Wildfly 10 Infinispan JCache:@CacheResult原因「數組類型或註釋類型的成員必須註釋@NonBinding」

我想用方法級別的緩存:

@CacheResult 
public Connector getConnector(String name) { 
    ... 
} 

我的應用程序的有關Maven依賴:

<dependencies> 
    <dependency> 
     <groupId>javax.enterprise</groupId> 
     <artifactId>cdi-api</artifactId> 
     <scope>provided</scope> 
    </dependency> 
    <dependency> 
     <groupId>javax.cache</groupId> 
     <artifactId>cache-api</artifactId> 
     <version>1.0.0</version> 
     <scope>provided</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.infinispan</groupId> 
     <artifactId>infinispan-jcache</artifactId> 
     <version>8.2.4.Final</version> 
     <scope>provided</scope> 
    </dependency> 
</dependencies> 

beans.xml

<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd" 
    version="1.2" bean-discovery-mode="annotated"> 
    <interceptors> 
     <class>org.infinispan.jcache.annotation.InjectedCacheResultInterceptor</class> 
     <class>org.infinispan.jcache.annotation.InjectedCachePutInterceptor</class> 
     <class>org.infinispan.jcache.annotation.InjectedCacheRemoveEntryInterceptor</class> 
     <class>org.infinispan.jcache.annotation.InjectedCacheRemoveAllInterceptor</class> 
     <class>org.infinispan.jcache.annotation.CacheResultInterceptor</class> 
     <class>org.infinispan.jcache.annotation.CachePutInterceptor</class> 
     <class>org.infinispan.jcache.annotation.CacheRemoveEntryInterceptor</class> 
     <class>org.infinispan.jcache.annotation.CacheRemoveAllInterceptor</class> 
    </interceptors> 
</beans> 

不過,我得到以下錯誤,當應用程序正在部署時:

WELD-001121: Member of array type or annotation type must be annotated @NonBinding: [EnhancedAnnotatedMethodImpl] public abstract javax.cache.annotation.CacheResult.cachedExceptions() 

javax.cache.annotation.CacheResult所有的方法都用@Nobinding

任何想法註釋這是很奇怪嗎?

謝謝!

回答

0
  • 你有沒有測試行爲刪除豆發現模式=「註釋」從beans.xml中
  • 你有沒有分配一個cacheName到@CacheResult註釋?
  • 這將是很好的,以使跟蹤調試中standalone.xml爲「org.infinispan」

我把它與運行「豆發現模式=所有」(如果豆子沒有規定。 xml,將其作爲默認值)並僅指示最後四個攔截器類:org.infinispan.jcache.annotation.Cache *

希望它有幫助,保持張貼。