Now that we stated the difference between Bean and Bean in stances, it’s time to list all the bean kind we’ve got in CDI and their specific behaviour.

Managed beans

Managed bean are the most obvious kind of bean available in CDI. They are defined by a class declaration.

According to the specification (section 3.1.1 Which Java classes are managed beans?):

A top-level Java class is a managed bean if it meets all of the following conditions: It is not a non-static inner class.

It is a concrete class, or is annotated @Decorator .

It does not implement javax.enterprise.inject.spi.Extension .

It is not annotated @Vetoed or in a package annotated @Vetoed .

It has an appropriate constructor - either: the class has a constructor with no parameters, or the class declares a constructor annotated @Inject .

All Java classes that meet these conditions are managed beans and thus no special declaration is required to define a managed bean. — CDI 1.2 specification

That’s for the general rules, a valid class can also be ignored if the bean discovery mode is set to none or annotated and the class doesn’t have a bean defining annotation.

To sum up, if you’re in the default bean discovery mode ( Annotated ) your class should follow the condition above and have at least one of the following annotation to become a CDI managed bean:

@ApplicationScoped , @SessionScoped , @ConversationScoped and @RequestScoped annotations,

all other normal scope types,

@Interceptor and @Decorator annotations,

all stereotype annotations (i.e. annotations annotated with @Stereotype ),

and the @Dependent scope annotation.

Another limitation is linked to client proxies. In a lot of occasion (interceptor or decorator, passivation, usage of normal scope, possible circularity), the container may need to provide a contextual instance wrapped in a proxy. For this reason, managed bean classes should be proxyable or the container will raise an exception.

Thus in addition to the above rules the spec also restrictions on managed bean class to support certain services or be in normal scopes.

So, if possible you should avoid the following limitation on your bean class to be sure that they can be proxyable:

it should have a non private constructor with parameters,

it shouldn’t be final,

it shouldn’t have non static final methods.