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:
- How to restrict what CDI considers to be a managed bean in a jar file?
- What is the benefit for CDI to consider every bean to be a managed bean?