14.3.4.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.cdi.interceptor.CacheResultInterceptor </class> <class> org.infinispan.cdi.interceptor.CachePutInterceptor </class> <class> org.infinispan.cdi.interceptor.CacheRemoveEntryInterceptor </class> <class> org.infinispan.cdi.interceptor.CacheRemoveAllInterceptor </class> </interceptors> </beans>