[cdi-dev] [JBoss JIRA] (CDI-377) automatic JSR-330 annotation processing problematic

Jozef Hartinger (JIRA) issues at jboss.org
Fri Feb 14 02:43:29 EST 2014


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

Jozef Hartinger commented on CDI-377:
-------------------------------------

{quote}The other obvious solution I see is to remove @Singleton from the list of Bean defining annotations. As CDI doesn't really support it, it wouldn't be too harmful for existing CDI app.
It would fix the problem since all beans in Spring or Guice libs that triggers CDI does it with this annotation.{quote}
This is much better than the previous solution. I can see these options:

# To introduce a no-bean-archive marker file (e.g. no-beans.xml). This solution:
#* is backwards compatible
#* only solves the problem for libraries that care and only in new or repackaged versions of the lib
# Deal with @Singleton somehow. For instance, we could keep @Singleton a bean defining annotation but say that out of the bean defining annotations used in a bean archive, at least one has to be a normal scope or a built-in scope for the bean archive to be recognized. That way we would still be picking up @Singletons as long as they are used together with pure CDI scopes. If there are only @Singletons or non-normal non-builtin scopes in the archive, it will not be recognized. This solution is:
#* similar to your recent proposal
#* probably trickier to define nicely
#* backwards incompatible, but the class of applications possibly affected by this is very small (basically only the apps using only @Singleton or non-normal non-builtin scopes)
                
> 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