Search code examples
jakarta-eejavabeanscdi

Definition of CDI beans


I have a question about the definition of CDI beans:

Does CDI bean refer to the beans which are injected using @Inject annotation or the beans which @Inject is used inside of them?


Solution

  • CDI beans refers to beans that are instantiated and managed by CDI so that you don't have to new them up and manage their lifecycle. Basically it the first "which are injected using @Inject annotation".

    So for instance beans annotated with @Named. CDI beans are the beans that can be injected using @Inject.

    On other hand you could inject CDI beans to EJB, which is not a CDI bean.