Which classes are beans?

We're going to explore the different kinds of beans that Weld supports without any work on our part.

Managed Beans

As mentioned earlier, the Managed Beans specification was introduced in Java EE 6 to provide a common definition of a Managed Bean. All that's required to create a Managed Bean is to annotate it with @ManagedBean, though CDI doesn't require us to do so.

Note

JSF also has a @ManagedBean annotation to define their beans, and it's important to not confuse the two as they are separate annotations. Future releases of the JSF specification will endeavor to close this gap by utilizing the annotation from the Managed Beans specification.

Earlier in this chapter, we covered the requirements for constructors of a Java class ...

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.