I am coming at this question from many years of using spring and just starting to look at JEE7 and CDI.
In the Spring world you have to stick @Component
on a bean to turn into spring bean that spring will inject with dependencies but in CDI it seems that there is no equivalent of @Component
.
To me CDI seems to imply that every class in my web application will be considered a CDI bean which seems undesirable because I have lot of java classes that are not using injection and I would not want some one to just stick @Inject
in those classes and have CDI do its magic.
Two questions:
Please see the documentation for bean-discovery-mode in beans.xml. This attribute was only made available in JEE7 and is not available in JEE6.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.