jsr342-experts@javaee-spec.java.net

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

From: Pete Muir <pmuir_at_bleepbleep.org.uk>
Date: Thu, 13 Dec 2012 14:57:28 +0100

Hi Markus,

WDYT about the whole proposal? Good idea?

On 13 Dec 2012, at 14:44, Markus Eisele wrote:

> Hi Pete,
>
> On 10 December 2012 14:52, Pete Muir <pmuir_at_bleepbleep.org.uk> wrote:
>
>> 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).

>
>> OPEN ISSUE: Should only scopes for which a CDI context exists be considered component defining? This could introduce some thorny edge cases, but would address the JSR-330 compatibility issue better.
>
> Can you elaborate on some of these? At the moment would be fine with that.

Well, say you use Guice or Spring with JSR-330 scope annotations. If we just enable all scope annotations as bean defining annotations, then these would get picked up. If we just did it for scopes that the CDI container knows it has a context for, they wouldn't. This would have no impact on performance, we would still have to scan these classes, but the CDI container can decide they aren't beans when it loads the class.

>
>> OPEN ISSUE: Should we extend auto-discover in beans.xml to allow complete disablement of scanning e.g. auto-discover="all|bean-defining-annotations-only|none" ?
>
> I tend to answer: yes on this one. But I'm not sure if this will be of
> a big advantage.

IMO it's mainly to do with the first one - keeping the 1.0 scanning model, whilst taking advantage of other 1.1 beans.xml features.

>
>
>> OPEN ISSUE: How should the ProcessAnnotatedType event instruct the container to discover a class as a bean? Perhaps something like event.discover(clazz)?
>
> Can't comment. Doesn't sound too bad for me.
>
>> OPEN ISSUE: Should we integrate this with the package level scanning control we have proposed for CDI 1.1?
>
> Yes, please!
>
> - M