Polish "Background Initialization" documentation
This commit is contained in:
parent
c76d681dc4
commit
193424c465
|
|
@ -522,23 +522,28 @@ allows for singling out specific beans for background initialization, covering t
|
||||||
entire bean creation step for each such bean on context startup.
|
entire bean creation step for each such bean on context startup.
|
||||||
|
|
||||||
Dependent beans with non-lazy injection points automatically wait for the bean instance
|
Dependent beans with non-lazy injection points automatically wait for the bean instance
|
||||||
to be completed. All regular background initializations are forced to complete at the
|
to be completed. All regular background initializations are forced to complete at the end
|
||||||
end of context startup. Only for beans additionally marked as `@Lazy`, the completion
|
of context startup. Only beans additionally marked as `@Lazy` are allowed to be completed
|
||||||
is allowed to happen later (up until first actual access).
|
later (up until the first actual access).
|
||||||
|
|
||||||
Background initialization typically goes together with `@Lazy` (or `ObjectProvider`)
|
Background initialization typically goes together with `@Lazy` (or `ObjectProvider`)
|
||||||
injection points in dependent beans. Otherwise, the main bootstrap thread is going to
|
injection points in dependent beans. Otherwise, the main bootstrap thread is going to
|
||||||
block when an actual background-initialized bean instance needs to be injected early.
|
block when an actual background-initialized bean instance needs to be injected early.
|
||||||
|
|
||||||
This form of concurrent startup applies to individual beans: If such a bean depends on
|
This form of concurrent startup applies to individual beans: if such a bean depends on
|
||||||
other beans, they need to have been initialized already, either simply through being
|
other beans, they need to have been initialized already, either simply through being
|
||||||
declared earlier or through `@DependsOn` which is enforcing initialization in the main
|
declared earlier or through `@DependsOn` which enforces initialization in the main
|
||||||
bootstrap thread before background initialization for the affected bean is triggered.
|
bootstrap thread before background initialization for the affected bean is triggered.
|
||||||
|
|
||||||
Note that a `bootstrapExecutor` bean of type `Executor` needs to be declared for
|
[NOTE]
|
||||||
background bootstrapping to be actually active. Otherwise, the background markers are
|
====
|
||||||
going to be ignored at runtime. The bootstrap executor may be a bounded executor just
|
A `bootstrapExecutor` bean of type `Executor` must be declared for background
|
||||||
for startup purposes or a shared thread pool which serves for other purposes as well.
|
bootstrapping to be actually active. Otherwise, the background markers will be ignored at
|
||||||
|
runtime.
|
||||||
|
|
||||||
|
The bootstrap executor may be a bounded executor just for startup purposes or a shared
|
||||||
|
thread pool which serves for other purposes as well.
|
||||||
|
====
|
||||||
|
|
||||||
|
|
||||||
[[beans-java-conditional]]
|
[[beans-java-conditional]]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue