title: Jersey 2.*. Custom InjectionResolver and "A HTTP GET method ... should not consume any entity"
body: <p>I have followed Michal's guide from his answer to this question [<a href="https://stackoverflow.com/questions/18463311/jersey-2-how-to-replace-injectableprovider-and-abstracthttpcontextinjectable">1</a>] on implementing custom annotation for injecting arbitrary things into resource methods. This (gist) [<a href="https://gist.github.com/anonymous/389e1e8064174bdcd102" rel="nofollow noreferrer">2</a>] contains a minimalistic testbed adapted from the <code>jersey-quickstart-grizzly2</code> archetype. I will refer to it in the following text.</p>
  
  <p>I encountered a few problems:</p>
  
  <ol>
  <li><p>My resolver is parametrized type (or at least it would make things much more cleaner, in my opinion) and thus I can not <code>bind</code> it in my binder the way Michal suggests.</p>
  
  <pre><code>// Instead of the suggested:
  // bind(MyInjectionResolver.class).to(new TypeLiteral&lt;InjectionResolver&lt;MyAnnotation&gt;&gt;() {}).in(Singleton.class);
  // I do:
  bind(myInjectionResolverObject).to(new TypeLiteral&lt;InjectionResolver&lt;MyAnnotation&gt;&gt;() {});
  </code></pre></li>
  <li><p>When I use <code>MyAnnotation</code> in the resource method, I get the following warning on server start-up (but the server still starts):</p>
  
  <pre><code>WARNING: The following warnings have been detected: WARNING: A HTTP GET method, public java.lang.String com.example.MyResource.get02(java.lang.Integer,java.lang.String), should not consume any entity.
  </code></pre></li>
  <li><p>When I request the resource (<code>curl -X GET http://localhost:8080/myresource/01/aa</code>), I get <code>02: value = aa; providedValue = null</code> instead of the expected <code>02: value = aa; providedValue = 123</code>.</p></li>
  <li><p>The <code>MyResolver.resolve</code> method is never executed (but <code>MyBinder.configure</code> is executed).</p></li>
  <li><p>(This does not concern the testbed application, but I encounter the problem in a slightly more complicated code: the resource method is never executed and the server responds with <code>500 No content to map to Object due to end of input</code>)</p></li>
  </ol>
  
  <p>Any ideas as to what I might be doing wrong? </p>