title: javax.annotation classes and Java 11 JDK
body: <p>I am migrating from Java 8 to Java 11 and faced the problem.
  I should use:</p>
  
  <ul>
  <li>maven-compiler-plugin 2.5.1 with target 1.8 (compiling WAR in java8)</li>
  <li>tomcat9</li>
  <li>Open JDK 11</li>
  </ul>
  
  <p>But on startup gettings constant error:</p>
  
  <blockquote>
    <p>Post-processing of merged bean definition failed; nested exception is
    java.lang.NoSuchMethodError:
    javax.annotation.Resource.lookup()Ljava/lang/String;</p>
  </blockquote>
  
  <p>I found multiple ways to fix it. Tried to add dependency:</p>
  
  <pre><code>        &lt;dependency&gt;
              &lt;groupId&gt;javax.annotation&lt;/groupId&gt;
              &lt;artifactId&gt;javax.annotation-api&lt;/artifactId&gt;
              &lt;version&gt;1.3.2&lt;/version&gt;
          &lt;/dependency&gt;
  </code></pre>
  
  <p>tried to add extention:</p>
  
  <pre><code>   &lt;extensions&gt;
          &lt;extension&gt;
              &lt;groupId&gt;javax.annotation&lt;/groupId&gt;
              &lt;artifactId&gt;javax.annotation-api&lt;/artifactId&gt;
              &lt;version&gt;1.3.2&lt;/version&gt;
          &lt;/extension&gt;
      &lt;/extensions&gt;
  </code></pre>
  
  <p>Nothing of these helped.</p>
  
  <p>This is maven-compiler-plugin config:</p>
  
  <pre><code>    &lt;plugin&gt;
          &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
          &lt;version&gt;2.5.1&lt;/version&gt;
          &lt;configuration&gt;
              &lt;source&gt;1.8&lt;/source&gt;
              &lt;target&gt;1.8&lt;/target&gt;
              &lt;encoding&gt;UTF-8&lt;/encoding&gt;
          &lt;/configuration&gt;
      &lt;/plugin&gt;
  </code></pre>
  
  <p>Please help to find the solution!!</p>