org.jboss.solder.bean.defaultbean
Annotation Type DefaultBean


@Retention(value=RUNTIME)
@Target(value={TYPE,METHOD,FIELD})
@Documented
public @interface DefaultBean

Annotation that signifies that a bean should only be registered if no other instance with the same type and qualifiers is registered. The bean only has the type specified in the value attribute and Object.

Managed beans, producer methods and producer fields can all be made into default beans.

If a managed bean is declared to be a default bean then all producers methods and fields on the bean are also considered to be default beans. In this case if the @DefaultBean annotation is not explicitly specified then the default bean type is considered to be the type returned by Method.getGenericReturnType() or Field.getGenericType() for a field.

In some ways this is similar to the functionality provided by @ Alternative however there are some important distinctions

It is also important to note that beans registered in the AfterBeanDiscovery event may not be picked up as default beans.

Author:
Stuart Douglas

Required Element Summary
 Class<?> value
           The type of the bean.
 

Element Detail

value

public abstract Class<?> value

The type of the bean. If another bean is found with this type and the same qualifiers this bean will not be installed.

This bean will only be installed with the type specified here



Copyright © 2011 Seam Framework. All Rights Reserved.