Java EE 6 @javax.annotation.ManagedBean vs. @javax.inject.Named vs. @javax.faces.ManagedBean

Viewed 43014

I feel there is a little mess in the Java EE 6 spec. There are several sets of annotations.

We have javax.ejb annotations like @Stateful and @Stateless for creating EJBs.

There is also a @javax.annotation.ManagedBean to create a managed bean.

There are annotations in javax.enterprise.context like @SessionScoped and @RequestScoped.

What is more there are also @ManagedBean and @SessionScoped/@RequestScoped annotations in javax.faces.bean package.

And to make things event more complicated there is a package javax.inject with @Named annotation.

Can someone please describe how they are related one to another?

Where can I use @EJB, @Inject or @ManagedPropery to inject other beans?

3 Answers
Related