[cdi-dev] [JBoss JIRA] (CDI-377) automatic JSR-330 annotation processing problematic
Antoine Sabot-Durand (JIRA)
issues at jboss.org
Mon Feb 17 11:17:49 EST 2014
[ https://issues.jboss.org/browse/CDI-377?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12945292#comment-12945292 ]
Antoine Sabot-Durand edited comment on CDI-377 at 2/17/14 11:16 AM:
--------------------------------------------------------------------
To sum up my understanding of {{@Singleton}} and other {{@Scope}} management, we have 3 options.
# *Stop supporting them in CDI*
Not possible IMO due to JSR 330 support and other bad side effects ({{@Dependent}} is annotated with {{@Scope}})
# *Remove them from the list of bean defining annotations list*
So by default ({{annotated}} bean-discovery-mode) classes with these Annotation wouldn't be considered as bean. {{@Dependent}} should be an exception. They would always be beans in {{all}} bean-discovery-mode. Perhaps the more consistent approach regarding mixing CDI and other JSR-330 beans in the same archive : allow me to have my Guice beans with {{@Singleton}} and CDI beans with CDI scopes living together.
# *Remove them from the list of bean defining annotations list unless one or more classes in the same archive are annotated with a {{@Dependent}} or any Normal Scope annotation*
In this case they wouldn't make their archive an implicit bean archive when they are alone. In the case of mixing JSR-330 beans and CDI beans the dev would have to explicitly put a {{@Vetoed}} on non CDI beans to avoid CDI treating them.
was (Author: antoinesabot-durand):
To sum up regarding {{@Singleton}} and other {{@Scope}} management, we have 3 options.
# *Stop supporting them in CDI*
Not possible IMO due to JSR 330 support and other bad side effects ({{@Dependent}} is annotated with {{@Scope}})
# *Remove them from the list of bean defining annotations list*
So by default ({{annotated}} bean-discovery-mode) classes with these Annotation wouldn't be considered as bean. {{@Dependent}} should be an exception. They would always be beans in {{all}} bean-discovery-mode. Perhaps the more consistent approach regarding mixing CDI and other JSR-330 beans in the same archive : allow me to have my Guice beans with {{@Singleton}} and CDI beans with CDI scopes living together.
# *Remove them from the list of bean defining annotations list unless one or more classes in the same archive are annotated with a {{@Dependent}} or any Normal Scope annotation*
In this case they wouldn't make their archive an implicit bean archive when they are alone. In the case of mixing JSR-330 beans and CDI beans the dev would have to explicitly put a {{@Vetoed}} on non CDI beans to avoid CDI treating them.
> automatic JSR-330 annotation processing problematic
> ---------------------------------------------------
>
> Key: CDI-377
> URL: https://issues.jboss.org/browse/CDI-377
> Project: CDI Specification Issues
> Issue Type: Bug
> Components: Java EE integration
> Affects Versions: 1.1.PFD
> Environment: glassfish-4
> Reporter: Reuben Pasquini
> Labels: CDI_spec_chge, CDI_tck_chge
> Fix For: 1.2 Proposed
>
>
> The jsr-330 dependency injection annotations (javax.inject.*) find use in javase environments using IOC packages like guice.
> Adding a dependency on a jar that uses guice or whatever in a javase environment
> to a war deployed to a jee7 container
> results in CDI processing annotated classes intended for
> app-managed injection. See this ticket filed with guava for a concrete example:
> https://code.google.com/p/guava-libraries/issues/detail?id=1433
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the cdi-dev
mailing list