ams
ams

Reputation: 62632

How to limit what CDI considers to be managed beans?

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:

Upvotes: 2

Views: 746

Answers (1)

Sekhon
Sekhon

Reputation: 108

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.

Upvotes: 1

Related Questions