[cdi-dev] [JBoss JIRA] (CDI-51) Support static injection

Vsevolod Golovanov (JIRA) issues at jboss.org
Tue Oct 6 09:22:00 EDT 2015

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

Vsevolod Golovanov commented on CDI-51:

The "Forum Reference" link is dead, quoting relevant part here.
Injection for static members has a couple of problems: 
* A class can be shared between multiple applications, and the Java EE spec does not define rules for this.
* Outside Java EE, it's difficult to define exactly when a static member is injected.

Nevertheless, there are a couple of great usecases for this: 
* logger injection,
* injection for entity classes, and
* injection into objects with a passivating scope.

So we do need to support something here. Perhaps it would be enough to say: 
* no static injection in shared libraries, and
* static fields are injected before the very first instance of a bean is instantiated (but then static injection would not be supported for non-bean classes).

> Support static injection
> ------------------------
>                 Key: CDI-51
>                 URL: https://issues.jboss.org/browse/CDI-51
>             Project: CDI Specification Issues
>          Issue Type: Feature Request
>          Components: Concepts
>    Affects Versions: 1.0
>            Reporter: Pete Muir
>             Fix For: TBD

This message was sent by Atlassian JIRA

More information about the cdi-dev mailing list