CDI annotated classes used both in EE6 context and Spring DI context -
i have issue concerning jar declaring cdi annotated beans, , used both in spring context , ee6 context.
this jar, service.jar
, contains classes annotated qualifiers (@qualifier
, allows declare own annotations such @dataaccessobject
in order identify beans), , has private members annotated @inject
.
it's compiled maven, , it's dependency javax.javaee-api
declared provided
, because these classes needed when deployed within ee6 context.
though, there's don't understand. in service.jar
, once compiled, , whether deploy in ee6 context or not, bytecode references classes such javax.inject.@inject
.
so why spring application - has no javax.javaee-api
jar in classpath - able load configuration correctly , run ? more confused when learned spring provides support @inject
(jsr 330) annotation.
can enlighten me on ?
thanks.
you must not confuse di (jsr330) , cdi (jsr299). cdi includes di. javax.inject annotations belong di , supported many frameworks (spring , guice example).
if strictly reduce jar dependencies jsr330 (no need switch java ee deps deployment), able use of supporting frameworks.
checkout example: http://www.mkyong.com/spring3/spring-3-and-jsr-330-inject-and-named-example/
Comments
Post a Comment