Add BootstrapRegistry for long lived instances
Add a simple `BootstrapRegistry` that can be used to store and share object instances across `EnvironmentPostProcessors`. The registry can be injected into the constructor of any `EnvironmentPostProcessor`. Registrations can also perform additional actions when the `ApplicationContext` has been prepared. For example, they could register the the bootstrap instances as beans so that they become available to the application. See gh-22956
This commit is contained in:
@@ -74,7 +74,7 @@ public final class RemoteSpringApplication {
|
||||
List<ApplicationListener<?>> listeners = new ArrayList<>();
|
||||
listeners.add(new AnsiOutputApplicationListener());
|
||||
listeners.add(new EnvironmentPostProcessorApplicationListener(
|
||||
EnvironmentPostProcessorsFactory.singleton(ConfigDataEnvironmentPostProcessor::new)));
|
||||
EnvironmentPostProcessorsFactory.of(ConfigDataEnvironmentPostProcessor.class)));
|
||||
listeners.add(new ClasspathLoggingApplicationListener());
|
||||
listeners.add(new LoggingApplicationListener());
|
||||
listeners.add(new RemoteUrlPropertyExtractor());
|
||||
|
||||
Reference in New Issue
Block a user