Configuring an Interceptor in EJB3.2 deployment descriptor

199 Views Asked by At

I would like to configure an Interceptor only in one Maven profile, so the obvious solution would be replacing the current annotation-based interceptor binding with a deployment descriptor based solution. However I cannot get this to work. Let's suppose, I have a bean:

// @MyInterceptor
@Stateless
public class MyBean {
    // ...
}

And I have a corresponding ejb-jar.xml:

<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar>
    <assembly-descriptor>
        <interceptor-binding>
            <ejb-name>MyBean</ejb-name>
            <interceptor-class>com.example.MyInterceptor</interceptor-class>
        </interceptor-binding>
    </assembly-descriptor>
</ejb-jar>

What am I doing wrong here?

0

There are 0 best solutions below