Default Interceptors in CDI Beans

I have a question. Whenever we have EJB banks

<ejb-jar
   xmlns = "http://java.sun.com/xml/ns/javaee"
   version = "3.0"
   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/ejb-jar_3_0.xsd"
        >
    <interceptors>
        <interceptor>
            <interceptor-class>net.bull.javamelody.MonitoringInterceptor</interceptor-class>
        </interceptor>
    </interceptors>
    <assembly-descriptor>
        <interceptor-binding>
            <ejb-name>*</ejb-name>
            <interceptor-class>net.bull.javamelody.MonitoringInterceptor</interceptor-class>
        </interceptor-binding>
    </assembly-descriptor>
</ejb-jar>

Now my MonitoringInterceptor will intercept all EJBs. The question is: can I do something similar with CDI interceptors?

<beans xmlns="http://java.sun.com/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>net.bull.javamelody.MonitoringInterceptor</class>
    </interceptors>

</beans>

I would like MonitoringInterceptor to install by default all the CDI Beans entered into the application. How can I get this? Thank you in advance for your reply.

+4
source share
2 answers

, - , " beans" - CDI. Beans . Beans, , , , : byteslounge.com//...

0

, .

EjbExtensionExtended

processAnnotatedType(@Observes ProcessAnnotatedType<T> pat) 

, beans

createEJBWrapper 

@EjbTransactional , .

0

All Articles