In my machine (Windows 10), there are two versions of Java, Java 1.8 (JRE and JDK) and Java 10 (JRE and JDK).
Previously IF I set my Eclipse
Well This happens Because @PostConstruct and @preDestroy are deprecated in java 9 onwards so better not to use them instead use interface to resolve this
Add javax.annotation-api-1.3.2.jar
to your classpath. It works with JDK 10 as well.
For more clarity on alternative approaches, go through below video link:
https://www.youtube.com/watch?v=jOYSRwwMLX8&list=PLzS3AYzXBoj9IBdtgXRSyZEwlU2QV-mGG&index=6
You can try to add annotation dependencies to pom.xml, so that they would be available for Spring:
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
</dependency>