[cdi-dev] [JBoss JIRA] (CDI-18) Global enablement of interceptors, decorators and alternatives

Mark Struberg (Commented) (JIRA) jira-events at lists.jboss.org
Thu Dec 8 10:35:43 EST 2011

    [ https://issues.jboss.org/browse/CDI-18?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12649280#comment-12649280 ] 

Mark Struberg commented on CDI-18:

Yes Pete, for the problem see the issue text. For why the BDA stuff became what it is now please see my very first comment:
> This issue originates from the interceptor order problematic

I'll try to sum up the discussion so far:

While discussing this very issue with BDAs we identified another related issue (class visibility) while discussing CDI-129 (@EnterpriseApplicationScoped): @Specializes. This doesn't need a BDA entry in beans.xml and is also broken atm.

My solution would be as follwing
a.) Introduce an 'ordinal' + 'enabled' in beans.xml for <interceptors>, <decorators> and <alternatives> as described in my first post. This will solve the interceptor ordering issue and remove the troubles with BDAs

b.) Specify the class visibility rules (see CDI-129 for the problem): 
"The container must ensure that for any 
* @Specializes @NScoped class Y extends X and
* @Alternative @NScoped class Y implements X
class Y is accessible by all classes which can access X in the same @NScoped context.

If the container discovers a
public @EnterpriseApplicationScoped class X {
defined in a shared ear-lib which has a
public @EnterpriseApplicationScoped @Specializes class Y extends class X {
defined in WEB-INF/classes of one of the EARs web application, a DeploymentException must be thrown.

Defining the
public @EnterpriseApplicationScoped @Specializes class Y extends class X {
in a shared ear-lib jar as well will be perfectly fine.

> Global enablement of interceptors, decorators and alternatives
> --------------------------------------------------------------
>                 Key: CDI-18
>                 URL: https://issues.jboss.org/browse/CDI-18
>             Project: CDI Specification Issues
>          Issue Type: Feature Request
>          Components: Beans, Decorators, Interceptors, Packaging and Deployment
>    Affects Versions: 1.0
>            Reporter: Mark Struberg
>            Priority: Critical
>             Fix For: 1.1 (Proposed)
> Currently the spec defines that <interceptors>, <decorators> and <alternatives> affect only the Bean Archives where they are configured in (via beans.xml). 
> Thus if you e.g. enable an Alternative in a WEB-INF/beans.xml, it does NOT count for the jars in it's WEB-INF/lib folder!
> This is pretty unhandy because you would need to repackage all your jars in your WEB-INF/lib folder and add/expand the <alternatives> sections in their beans.xml.
> Needless to say that this is not only hard to do in a company build but is also impossibly to handle at deploy time in an OSGi environment!

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the cdi-dev mailing list