I have an issue concerning a jar declaring CDI annotated beans, and used both in a spring context and an EE6 context.
This jar, say service.jar
, contains classes that are annotated with qualifiers (@Qualifier
, allows you to declare your own annotations such as @DataAccessObject
in order to identify your beans), and has private members annotated with @Inject
.
It's compiled with maven, and it's dependency to javax.javaee-api
is declared as provided
, because these classes are only needed when deployed within an EE6 context.
Though, there's something that I don't understand. In this service.jar
, once compiled, and whether I deploy it in an EE6 context or not, the bytecode references classes such as javax.inject.@Inject
.
So why my spring application - which has no javax.javaee-api
jar in its classpath - is able to load its configuration correctly and run ?
I was even more confused when I learned that spring provides support for @Inject
(JSR 330) annotation.
Can anyone enlighten me on that ?
Thanks.