title: How to resolve java error: package javax.annotation is not visible, Java version 9
body: <p>When building below Spring session sample using gradle:
  <a href="https://docs.spring.io/spring-session/docs/current/reference/html5/guides/boot-findbyusername.html" rel="noreferrer">https://docs.spring.io/spring-session/docs/current/reference/html5/guides/boot-findbyusername.html</a></p>
  
  <p>I encountered an error regarding to java.annotation module, anybody have idea how to resolve that? </p>
  
  <pre><code>/spring-session/spring-session-core/src/main/java/org/springframework/session/config/annotation/web/http/SpringHttpSessionConfiguration.java:22: error: package javax.annotation is not visible
  import javax.annotation.PostConstruct;
              ^
    (package javax.annotation is declared in module java.xml.ws.annotation, which is not in the module graph)
  warning: unknown enum constant When.MAYBE
    reason: class file for javax.annotation.meta.When not found
  1 error
  1 warning
  
  FAILURE: Build failed with an exception.
  
  * What went wrong:
  Execution failed for task ':spring-session-core:compileJava'.
  &gt; Compilation failed; see the compiler error output for details.
  </code></pre>
  
  <p>I tried to add below config in build.gradle however the problem remain.</p>
  
  <pre><code>tasks.withType(AbstractCompile) {
    options.compilerArgs += ["--add-modules", "java.xml.bind"]
  }
  
  tasks.withType(Test) {
    jvmArgs += ["--add-modules", "java.xml.bind"]
  }
  </code></pre>