I followed the exact steps in this documentation.
I have the following entries in my META-INF/spring.factories
org.springframework.boot.env.EnvironmentPostProcessor=com.mygroup.myapp.CustomEnvironmentPostProcessor
My post processor:
public class CustomEnvironmentPostProcessor
implements EnvironmentPostProcessor, Ordered {
..
}
I don't see anything in the logs as if it didn't get registered or not existing.
I unzipped the JAR and I can see META-INF/spring.factories. I can also see BOOT-INF/classes directly from the root.
What am I missing here?
There is no elegant way to solve this. You can make something like this :
@Component
public class CustomEnvironmentPostProcessor implements
EnvironmentPostProcessor, ApplicationListener<ApplicationEvent> {
private static final DeferredLog log = new DeferredLog();
@Override
public void postProcessEnvironment(
ConfigurableEnvironment env, SpringApplication app) {
log.error("This should be printed");
}
@Override
public void onApplicationEvent(ApplicationEvent event) {
log.replayTo(CustomEnvironmentPostProcessor.class);
}
}
define spring.factories file
Environment Post Processor
org.springframework.boot.env.EnvironmentPostProcessor=\
class name with package
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With