[cdi-dev] [JBoss JIRA] (CDI-218) Honor WEB-INF/classes/META-INF/beans.xml to activate WEB-INF/classes a bean archive

Craig Ringer (JIRA) jira-events at lists.jboss.org
Tue Jun 12 23:06:04 EDT 2012

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

Craig Ringer commented on CDI-218:

This would be a big usability improvement, though I'm strongly against warning if both are present. If both are present it should be a fatal deployment error, anything else will create more confusion down the track.

Maybe implementations should be permitted to vary the behaviour with a configuration option or system property, in case someone for some reason needs to deploy a broken archive they can't modify. It seems unlikely but not impossible. IMO it's important to fail to deploy by default. 

CDI already has too much subtle magic, adding more won't help make it usable. Warnings usually get drowned in the logging spew from app servers, so they'll often be missed.

Most importantly, honouring one over the other may lead to things like security interceptors not being enabled. That's bad enough that I think a deployment error is warranted. The implementation could check to see whether one of the beans.xml files was just an empty marker with no child elements and ignore that one, but IMO anything else is unsafe.
> Honor WEB-INF/classes/META-INF/beans.xml to activate WEB-INF/classes a bean archive
> -----------------------------------------------------------------------------------
>                 Key: CDI-218
>                 URL: https://issues.jboss.org/browse/CDI-218
>             Project: CDI Specification Issues
>          Issue Type: Feature Request
>          Components: Packaging and Deployment
>            Reporter: Dan Allen
>            Priority: Minor
> Chapter 12.1 specifies that beans.xml must be in the WEB-INF directory of a web archive to activate the WEB-INF/classes directory of that war as a bean archive (and thus make java:comp/BeanManager visible to the web app).
> However, many developers find this location both confusing and inconvenient at times. The instinct of many developers is to put the beans.xml in WEB-INF/classes/META-INF since that follows the convention that applies to library jars.
> Obviously, we cannot break backwards compatibility. Therefore, this issue proposes to honor either location in the war:
> - WEB-INF/beans.xml
> - WEB-INF/classes/META-INF/beans.xml
> If both files are present, the WEB-INF/beans.xml should take precedence and a warning is recommended. (Merging them is not likely the behavior that a developer would want).

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