What does it mean to be a bean?

According to the CDI specification:

A bean comprises the following attributes:

  • A (non-empty) set of bean types
  • A (non-empty) set of qualifiers
  • A scope
  • Optionally, a bean EL name
  • A set of interceptor bindings
  • A bean implementation

Furthermore, a bean may or may not be an alternative.

Bean types

In most cases, beans acquire references to other beans through dependency injection. The point at which a bean is injected will specify the type of that bean and a set of qualifiers. With the help of the bean type and qualifiers, Weld determines the implementation of a bean to provide for injection.

A bean type can be a class or interface that is visible to clients that wish to inject it. For instance, an EJB Session Bean implementation ...

Get JBoss Weld CDI for Java Platform now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.