|
28 | 28 | import org.springframework.boot.DefaultBootstrapContext;
|
29 | 29 | import org.springframework.boot.SpringApplication;
|
30 | 30 | import org.springframework.boot.env.EnvironmentPostProcessor;
|
| 31 | +import org.springframework.boot.env.EnvironmentPostProcessorsFactory; |
31 | 32 | import org.springframework.boot.logging.DeferredLogFactory;
|
32 | 33 | import org.springframework.cloud.autoconfigure.RefreshAutoConfiguration;
|
33 | 34 | import org.springframework.cloud.context.config.ContextRefreshedWithApplicationEvent;
|
@@ -76,12 +77,8 @@ protected void updateEnvironment() {
|
76 | 77 | // decrypt happen after refresh. The hard coded call to
|
77 | 78 | // ConfigDataEnvironmentPostProcessor.applyTo() is now automated as well.
|
78 | 79 | DeferredLogFactory logFactory = new PassthruDeferredLogFactory();
|
79 |
| - SpringFactoriesLoader.ArgumentResolver argumentResolver = SpringFactoriesLoader.ArgumentResolver.of(DeferredLogFactory.class, logFactory); |
80 |
| - argumentResolver = argumentResolver.and(ConfigurableBootstrapContext.class, bootstrapContext); |
81 |
| - argumentResolver = argumentResolver.and(BootstrapContext.class, bootstrapContext); |
82 |
| - argumentResolver = argumentResolver.and(BootstrapRegistry.class, bootstrapContext); |
83 |
| - SpringFactoriesLoader loader = SpringFactoriesLoader.forDefaultResourceLocation(getClass().getClassLoader()); |
84 |
| - List<EnvironmentPostProcessor> postProcessors = loader.load(EnvironmentPostProcessor.class, argumentResolver); |
| 80 | + EnvironmentPostProcessorsFactory environmentPostProcessorsFactory = EnvironmentPostProcessorsFactory.fromSpringFactories(getClass().getClassLoader()); |
| 81 | + List<EnvironmentPostProcessor> postProcessors = environmentPostProcessorsFactory.getEnvironmentPostProcessors(logFactory, bootstrapContext); |
85 | 82 | for (EnvironmentPostProcessor postProcessor : postProcessors) {
|
86 | 83 | postProcessor.postProcessEnvironment(environment, application);
|
87 | 84 | }
|
|
0 commit comments