[javaee-spec users] [jsr342-experts] Re: Proposal for global CDI enablement

From: Jason Greene <>
Date: Fri, 14 Dec 2012 14:42:43 -0600

On Dec 14, 2012, at 2:06 PM, Jim Knutson <> wrote:

> Pete Muir <> wrote on 12/13/2012 07:57:28 AM:
> > >> OPEN ISSUE: Should auto-discover be false by default for
> > beans.xml with version 1.1. This would mean that adding a beans.xml
> > would have no impact on discovery for 1.1 apps, however it is a
> > significant change from 1.0.
> > >
> > > No, please keep this in line with 1.0 behavior. If I think of the many
> > > lightweight migrated applications that rely on backward compatibility:
> > > Please don't change it!
> >
> > Note this would only be for beans.xml with the version attribute
> > updated to 1.1 so it wouldn't happen without a user actively doing
> > something. They could upgrade to the 1.1 schema, and set auto-
> > discover to all to keep CDI 1.0 behavior (we would make the auto-
> > discover attribute or element required).
> I worry about making behavior decisions based on "DD" versions. It would
> be better to make an explicit metadata declaration to change behavior.
> Changing a version is necessary for syntax (i.e. I need to specify
> additional metadata not supported in the current version, not for
> behavior. Using a version change to modify behavior is like programming
> with side effects. It will come back to bite you at some point.

To be more specific the idea was:

1. We would add a standard version="" attribute to the root element similar to other java EE descriptors
2. When version is set to "1.1" (or later), the deployer or deployment tool would enforce the specification of "bean-discovery-mode (annotated, all, none)" (likely a better name would be chosen).
3. The 1.1 xml schema would also require specification of bean-discovery-mode
4. Absence of the version attribute in the descriptor, or a value set to 1.0 would assume bean-discovery-mode="all", and not require specification

So in other words, runtime behavior is not altered based on version, only the descriptor specification is made more strict.