#47272 added back the previous EnvironmentPostProcessor in deprecated form, but the implementation (3a9ab15) seems incomplete.
The following fails:
import org.junit.jupiter.api.Test;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.bootstrap.ConfigurableBootstrapContext;
import org.springframework.boot.env.EnvironmentPostProcessor;
import org.springframework.boot.logging.DeferredLogFactory;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.util.Assert;
@SpringBootTest
class DemoApplicationTests {
@Test
void contextLoads() {
}
static class DeprecatedEnvironmentPostProcessor implements EnvironmentPostProcessor {
public DeprecatedEnvironmentPostProcessor(DeferredLogFactory logFactory, ConfigurableBootstrapContext bootstrapContext) {
Assert.notNull(logFactory, "logFactory must not be null");
Assert.notNull(bootstrapContext, "bootstrapContext must not be null");
}
@Override
public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) {
}
}
}
I had expected that the deprecated EnvironmentPostProcessor continue to work, but fails due to null constructor arguments.
Looks like the call to load the deprecated EnvironmentPostProcessor missed providing the ArgumentResolver as it does for the non-deprecated variant:
|
postProcessors.addAll(this.loader.load(EnvironmentPostProcessor.class, argumentResolver)); |
|
return this.loader.load(org.springframework.boot.env.EnvironmentPostProcessor.class); |
#47272 added back the previous EnvironmentPostProcessor in deprecated form, but the implementation (3a9ab15) seems incomplete.
The following fails:
I had expected that the deprecated
EnvironmentPostProcessorcontinue to work, but fails due to null constructor arguments.Looks like the call to load the deprecated
EnvironmentPostProcessormissed providing theArgumentResolveras it does for the non-deprecated variant:spring-boot/core/spring-boot/src/main/java/org/springframework/boot/support/SpringFactoriesEnvironmentPostProcessorsFactory.java
Line 55 in c7ec1fa
spring-boot/core/spring-boot/src/main/java/org/springframework/boot/support/SpringFactoriesEnvironmentPostProcessorsFactory.java
Line 63 in c7ec1fa