15.2.3.2. Enable Cache Annotations
Interceptors can be added to the CDI bean archive using the
beans.xml
file. Adding the following code adds interceptors such as the CacheResultInterceptor
, CachePutInterceptor
, CacheRemoveEntryInterceptor
and the CacheRemoveAllInterceptor
:
<beans xmlns="http://java.sun.som/xml/ns/javaee" xmlns:xsi="http://www/w3/org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd" > <interceptors> <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>
Note
The listed interceptors must appear in the
beans.xml
file for Red Hat JBoss Data Grid to use javax.cache annotations.