Annotation Type Lazy
Constructs this bean the first time something calls it, instead of at start-up.
The build injects a generated subclass that constructs the real bean on the first call and delegates to it. The class must therefore be possible to subclass: not final, with a constructor taking no arguments that the subclass can call.
That constructor runs once at start-up, for the stand-in itself, because a
subclass cannot be built without it. So keep it cheap, and put the expensive
set-up in a @PostConstruct method: that runs only on the real instance, on
first use.
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionbooleanWhether the bean is lazy; false undoes a class-level annotation.
-
Element Details
-
value
boolean valueWhether the bean is lazy; false undoes a class-level annotation.- Default:
true
-