2017-08-02 95 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 *

希望它有帮助,保持张贴。