泽西岛2.*.自定义InjectionResolver和"HTTP GET方法......不应该使用任何实体"

The*_*One 6 java dependency-injection jax-rs jax-ws jersey

我从他对这个问题[ 1 ]的答案中听取了Michal的指南,该问题涉及实现自定义注释以将任意事物注入资源方法.这个(要点)[ 2 ]包含一个从jersey-quickstart-grizzly2原型改编而来的简约试验台.我将在下文中提及它.

我遇到了一些问题:

  1. 我的解析器是参数化类型(或者至少它会让事情变得更加清洁,在我看来)因此我不能bind像Michal所说的那样在我的活页夹中.

    // Instead of the suggested:
    // bind(MyInjectionResolver.class).to(new TypeLiteral<InjectionResolver<MyAnnotation>>() {}).in(Singleton.class);
    // I do:
    bind(myInjectionResolverObject).to(new TypeLiteral<InjectionResolver<MyAnnotation>>() {});
    
    Run Code Online (Sandbox Code Playgroud)
  2. 当我MyAnnotation在资源方法中使用时,我在服务器启动时收到以下警告(但服务器仍然启动):

    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.
    
    Run Code Online (Sandbox Code Playgroud)
  3. 当我请求resource(curl -X GET http://localhost:8080/myresource/01/aa)时,我得到的02: value = aa; providedValue = null不是预期的02: value = aa; providedValue = 123.

  4. MyResolver.resolve方法永远不会执行(但会MyBinder.configure被执行).

  5. (这与测试平台应用程序无关,但我在稍微复杂的代码中遇到了问题:资源方法永远不会执行,服务器会响应500 No content to map to Object due to end of input)

关于我可能做错什么的任何想法?