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

Reuben Pasquini (JIRA) jira-events at lists.jboss.org
Tue Sep 17 14:46:04 EDT 2013

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

Reuben Pasquini commented on CDI-377:

@Mark - Maven 3.1 may be ok with @Inject annotations - for example - guice is lazy in its annotation processing, so guice will only inject a mavin class if it's required by some class needed at runtime:

     class Plugin { ... @Inject() public Plugin( MavinThing thing, ... ) { ... } ... }

In other words - mavin's IOC world can exist along side some plugin's IOC world 
assuming the two worlds are working with their own set of classes.
I guess OSGi is designed for this kind of plugin dso hell ...

I think CDI is causing problems, because it eagerly allocates @Singleton classes that may not be needed at runtime, and may not have all dependencies available either.
There are several ways CDI could make itself a more friendly JSR330 neighbor.
It would be great if either or both of:

  o. CDI ignored jars that do not include a beans.xml
  o. CDI provided some outside-the-jar override mechanism in a .war or .ear or whatever
    file like WEB-INF/web.xml or the app-root META-INF/beans.xml:

Something like that ...

> 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, guava, guice
>             Fix For: 1.1.PFD
> 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