mercredi 17 juin 2015

Default Interceptors in CDI Beans

I have a question. Whenever we have EJB jars

<ejb-jar
   xmlns = "http://ift.tt/nSRXKP"
   version = "3.0"
   xmlns:xsi = "http://ift.tt/ra1lAU"
   xsi:schemaLocation = "http://ift.tt/nSRXKP http://ift.tt/1j5lPXE"
        >
    <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 Intercept all EJBs. Here comes a question: can I do something similar with CDI Interceptors?

<beans xmlns="http://ift.tt/nSRXKP"
       xmlns:xsi="http://ift.tt/ra1lAU"
       xsi:schemaLocation="
      http://ift.tt/nSRXKP
      http://ift.tt/1fbVfcw">
    <interceptors>
        <class>net.bull.javamelody.MonitoringInterceptor</class>
    </interceptors>

</beans>

I would like to have MonitoringInterceptor set by default to all CDI Beans injected to application. How can I acquire that? Thank you in advance for the reply.

Aucun commentaire:

Enregistrer un commentaire