-
1. Re: InjectionTarget.getInjectionPoints() ignores static field injection points
mkouba Mar 26, 2015 4:31 AM (in response to emilyj)Well, I think a CDI container is not required to support application client jar bean archives (see also 12.1. Bean archives). And to my knowledge, the proposal to support injection of static fields/methods was rejected during the work on CDI 1.1.
-
2. Re: InjectionTarget.getInjectionPoints() ignores static field injection points
emilyj Mar 26, 2015 11:14 AM (in response to mkouba)Thanks Martin for your quick response! In the CDI 1.2 spec, it states:
When determining which archives are bean archives, the container must consider:
• Library jars, EJB jars or application client jars
• The WEB-INF/classes directory of a war
• Directories in the JVM classpath
The container is not required to support application client jar bean archives.
It suggests the container must consider application client jars as bean archives but it is not required to support it. If it is not required to support, what is the point to consider the application client jars? I feel it contradicts itself.In EE7 spec, under the section Application Client EE.10.4, it says
The component classes listed with support level “Limited” only support Java EE field injection and the PostConstruct callback. Note that these are application client main classes, where field injection is into static fields.
It suggests application clients should support CDI.
However, in EE7 spec EE.5.24, it says:
In Java EE, support for dependency injection annotations as specified in the Dependency Injection for Java specification is mediated by CDI. Containers must support injection points annotated with the javax.inject.Inject annotation only to the extent dictated by CDI.
It seems CDI spec has more authority than ee7 spec. Am I right to say that even if an application server doesn't support cdi for client application jars, it can still pass EE7 spec compliance tests?
-
3. Re: InjectionTarget.getInjectionPoints() ignores static field injection points
mkouba Mar 27, 2015 4:30 AM (in response to emilyj)It suggests the container must consider application client jars as bean archives but it is not required to support it. If it is not required to support, what is the point to consider the application client jars? I feel it contradicts itself.
Yes, it sounds a bit odd. I believe that the intent was to list all the archives which could become bean archives.
It seems CDI spec has more authority than ee7 spec. Am I right to say that even if an application server doesn't support cdi for client application jars, it can still pass EE7 spec compliance tests?
The CDI TCK does not test application client jars. I'm not sure about EE 7 TCK as a whole.