I\'ve got problem with using @PostConstruct and@PostDestroy annotations in my project. I can\'t use these annotations and it looks like these doesn
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:
For Maven
javax.annotation
javax.annotation-api
1.3.2
If using Gradle
implementation "javax.annotation:javax.annotation-api:1.3.2"
Found here: https://www.baeldung.com/spring-postconstruct-predestroy