BootstrapRegistry
interface BootstrapRegistry
A simple object registry that is available during startup and Environment post-processing up to the point that the ApplicationContext is prepared.
Can be used to register instances that may be expensive to create, or need to be shared before the ApplicationContext is available.
The registry uses Class as a key, meaning that only a single instance of a given type can be stored.
The addCloseListener method can be used to add a listener that can perform actions when BootstrapContext has been closed and the ApplicationContext is fully prepared. For example, an instance may choose to register itself as a regular Spring bean so that it is available for the application to use.
Author
Phillip Webb
Since
2.4.0
See also
Inheritors
Functions
Link copied to clipboard
Add an ApplicationListener that will be called with a BootstrapContextClosedEvent when the BootstrapContext is closed and the ApplicationContext has been prepared.
Link copied to clipboard
abstract fun <T> getRegisteredInstanceSupplier(type: Class<T>): BootstrapRegistry.InstanceSupplier<T>
Return any existing InstanceSupplier for the given type.
Link copied to clipboard
Return if a registration exists for the given type.
Link copied to clipboard
abstract fun <T> registerIfAbsent(type: Class<T>, instanceSupplier: BootstrapRegistry.InstanceSupplier<T>)
Register a specific type with the registry if one is not already present.