[resteasy-dev] CDI stereotype usage in JAX-RS annotated methods
Martin Stefanko
mstefank at redhat.com
Fri Nov 2 06:16:36 EDT 2018
I think the idea is that user can group a few JAX-RS annotations together
and apply them on more than one resource with the stereotype annotation
instead of copy-pasting them every time [1]. But sure, in the issue example
case it does not simplify anything.
[1] https://gist.github.com/xstefank/6893d8c9461dd21e1a80e7837fc3492a
Thanks,
Martin Stefanko
Software Engineer
JBoss Sustaining Engineering Team
Red Hat
On Fri, Nov 2, 2018 at 10:30 AM Jim Ma <ema at redhat.com> wrote:
> I don't get what's the good thing to include
> @Produces(MediaType.APPLICATION_JSON) to @Stereotype annotation.
> From RESTEASY-1821 reproducer code, It doesn't simplify thing to annotate
> @RestService stereotype to SomeRestServce, moreover
> it introduces other annotation clash issue as you said. It's better to let
> Resteasy process @Produce annotation directly instead of
> CDI container.
>
> @Path("/some")
> @RestService
> public class SomeRestService {
> @GET
> @Path("/")
> public Response getSome() {
> return Response.ok().entity("{\"x\" : 42, \"y\" :
> \"foo\"}").build();
> }
> }
>
> Thanks,
> Jim
>
> On 11/01/2018 09:33 PM, Martin Stefanko wrote:
>
> Hi all,
>
> in my issue [1] I am facing a decision whether to include CDI stereotype
> usage also in JAX-RS annotated methods. The problem is that to allow
> stereotypes to be picked up by CDI they need to be placed on the producer
> method or field [2] which means they need to be annotated by
> *javax.enterprise.inject.Produces* annotation. This annotation already
> clashes with JAX-RS *javax.ws.rs.Produces *and additionally impose
> problems (ambiguous injection) when several methods with the same return
> type would use stereotypes (I've created simple example at [3]). This is
> why I want to ask for the community opinion whether or not should RestEasy
> support stereotypes on JAX-RS methods.
>
> [1] https://issues.jboss.org/browse/RESTEASY-1821
> [2] http://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#declaring_stereotypes
> [3] https://gist.github.com/xstefank/914614d8250cdc40c0047f55cff484a2
>
> Thank you,
> Martin Stefanko
>
> Software Engineer
> JBoss Sustaining Engineering Team
> Red Hat
>
>
> _______________________________________________
> resteasy-dev mailing listresteasy-dev at lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/resteasy-dev
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/resteasy-dev/attachments/20181102/b2eba1ad/attachment-0001.html
More information about the resteasy-dev
mailing list