Package io.quarkus.arc
Annotation Type DefaultBean
-
@Retention(RUNTIME) @Target({METHOD,TYPE,FIELD}) public @interface DefaultBean
If a bean is annotated with this annotation, it means that the bean will only be used as a default bean if no other bean of this type is configured. If another bean is configured however, the default bean is not used. Here is an example:@Dependent public class SomeConfiguration { @Produces @DefaultBean public MyBean create() { // create bean } }
If this code is used and MyBean is not defined anywhere else, then the result ofcreate()
is used in all injection points. However, if there is another piece of configuration code that looks like:@Dependent public class SomeOtherConfiguration { @Produces public MyBean override() { // create bean } }
Then the result ofoverride()
will be used as MyBean in all injection points.