Annotation Interface Bean
Marks a factory method in a
Configuration class whose return value is registered as a singleton.
The bean is registered under the method's declared return type, so returning an interface makes the
bean injectable by that interface. Method parameters are resolved like constructor parameters.
The returned object gets field injection and PostConstruct unless it is already managed by the registry.
Each type can only be provided once: a second Bean for the same type, a Service class of
that type, a Service that binds to it, or an instance registered under it are reported as errors.
A bean takes precedence over automatic implementation discovery for interfaces and abstract classes.
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionbooleanWhether the bean is created on startup instead of when it is first needed.
Default is false (lazy loading).
-
Element Details
-
eagerlyLoad
boolean eagerlyLoadWhether the bean is created on startup instead of when it is first needed.
Default is false (lazy loading).- Default:
false
-