Browse Source

Support deprecated EnvironmentPostProcessor arguments

Fixes gh-48047
pull/48068/head
Phillip Webb 1 month ago
parent
commit
6158a52b8c
  1. 7
      core/spring-boot/src/main/java/org/springframework/boot/support/SpringFactoriesEnvironmentPostProcessorsFactory.java

7
core/spring-boot/src/main/java/org/springframework/boot/support/SpringFactoriesEnvironmentPostProcessorsFactory.java

@ -53,14 +53,15 @@ class SpringFactoriesEnvironmentPostProcessorsFactory implements EnvironmentPost
argumentResolver = argumentResolver.and(BootstrapRegistry.class, bootstrapContext); argumentResolver = argumentResolver.and(BootstrapRegistry.class, bootstrapContext);
List<Object> postProcessors = new ArrayList<>(); List<Object> postProcessors = new ArrayList<>();
postProcessors.addAll(this.loader.load(EnvironmentPostProcessor.class, argumentResolver)); postProcessors.addAll(this.loader.load(EnvironmentPostProcessor.class, argumentResolver));
postProcessors.addAll(loadDeprecatedPostProcessors()); postProcessors.addAll(loadDeprecatedPostProcessors(argumentResolver));
AnnotationAwareOrderComparator.sort(postProcessors); AnnotationAwareOrderComparator.sort(postProcessors);
return postProcessors.stream().map(Adapter::apply).collect(Collectors.toCollection(ArrayList::new)); return postProcessors.stream().map(Adapter::apply).collect(Collectors.toCollection(ArrayList::new));
} }
@SuppressWarnings("removal") @SuppressWarnings("removal")
private List<org.springframework.boot.env.EnvironmentPostProcessor> loadDeprecatedPostProcessors() { private List<org.springframework.boot.env.EnvironmentPostProcessor> loadDeprecatedPostProcessors(
return this.loader.load(org.springframework.boot.env.EnvironmentPostProcessor.class); ArgumentResolver argumentResolver) {
return this.loader.load(org.springframework.boot.env.EnvironmentPostProcessor.class, argumentResolver);
} }
@SuppressWarnings("removal") @SuppressWarnings("removal")

Loading…
Cancel
Save