[jax-rs-spec users] Re: [jsr339-experts] Back To DI in Subresources

From: <>
Date: Tue, 17 Apr 2012 03:11:40 +0000 (GMT)

Just to add to the chorus, I'd like to be able to do something like

       public static class TestResourceWithSubLocator
          @Context AnnotationProcessor processsor; // <-- here
          public TestSubResource property()
             TestSubResource tsr = new TestSubResource();
             processor.injectAndValidateEveryDamnThing(tsr); // <--
and here
             return tsr;

       public static class TestSubResource
          private String s;
          @Size(min=2, max=4)
          private String t;

          @Size(min=2, max=4)
          public String getS()
             return s;

          public void setS(@PathParam("s") String s)
             this.s = s;
It's just a shame to have all that code implemented in the JAX-RS
provider but make the user do it all over again.

By the way, this is a minor point, but I noticed that Section 1.5
"Terminology" and Section 3.4.1 "Sub Resources" define "sub-resource
methods" and "sub-resource locators" but don't actually define
"sub-resources". It seems like a concept worthy of a definition.