I am trying to use annotations with two methods in Spring in Java 9.
import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; . . . @PostConstruct public void myFoo() { System.out.println("postconstruct - foo"); } @PreDestroy public void myFoo2() { System.out.println("predestroy - foo2"); }
I get the following errors:
Error:(7, 13) java: package javax.annotation is not visible (package javax.annotation is declared in module java.xml.ws.annotation, which is not in the module graph) Error:(8, 13) java: package javax.annotation is not visible (package javax.annotation is declared in module java.xml.ws.annotation, which is not in the module graph)
Why am I getting an error message? The result of the examples works well in Java 8. Is there a solution?
source share