Java 11 - Replace Spring @PostConstruct with afterPropertiesSet or using initMethod
问题 I'm using spring applications which sometimes uses @PostConstruct for setup in code and tests It seems that annotation will be excluded from Java 11: Note that both @PostConstruct and @PreDestroy annotations are part of Java EE. And since Java EE has been deprecated in Java 9 and removed in Java 11 we have to add an additional dependency to use these annotations Article suggest replacing all @PostConstruct with afterPropertiesSet method I recommend you to change implementation from