Digital Marketing

Bean defining annotations and @Named

A bean class may have a bean defining annotation, allowing it to be placed anywhere in an application, as defined in Bean archives. A bean class with a bean defining annotation is said to be an implicit bean.

The set of bean defining annotations contains:
  • @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.
@Named is not a bean defining annotation. @Named has only one usage : expose your bean to the UI. Other usages are for bad practice or compatibility with legacy framework.

Comments

Popular posts from this blog

MySQL Sandbox with the Sakila sample database