[jboss-jira] [JBoss JIRA] (WFLY-8136) allow JAX-RS @Produces in CDI @Stereotype

Andreas Klemp (JIRA) issues at jboss.org
Thu Feb 16 04:55:00 EST 2017


Andreas Klemp created WFLY-8136:
-----------------------------------

             Summary: allow JAX-RS @Produces in CDI @Stereotype
                 Key: WFLY-8136
                 URL: https://issues.jboss.org/browse/WFLY-8136
             Project: WildFly
          Issue Type: Feature Request
          Components: CDI / Weld
    Affects Versions: 9.0.1.Final
         Environment: Windows 7, JDK 1.8.0_60
            Reporter: Andreas Klemp
            Assignee: Stuart Douglas


A simple JAX-RS REST service can be annotated with @Produces to define the resulting mime-type. However, it is not working anymore, when the annotation is moved to a stereotype. The default application/octet-stream is used.

{code}
@Stereotype
@Produces(MediaType.APPLICATION_JSON)
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface RestService {
}

@Path("/some")
@RestService
public class SomeRestService {
    @GET
    @Path("/")
    public Response getSome() {
        return Response.ok().entity("{\"x\" : 42, \"y\" : \"foo\"}").build();
    }
}
{code}

Using the following dependencies in Gradle project.

{noformat}
providedCompile(
    [group: 'javax.enterprise', name: 'cdi-api', version: '1.2'],
    [group: 'org.jboss.spec.javax.ws.rs', name: 'jboss-jaxrs-api_2.0_spec', version: '1.0.0.Final'],
    [group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.7.4']
)
{noformat}



--
This message was sent by Atlassian JIRA
(v7.2.3#72005)


More information about the jboss-jira mailing list