I try to run a CXF JAX-RS endpoint using Spring XML configuration and Spring Boot.

The services are listed correctly when I access the server and the WADL/Swagger endpoint is generated correctly:

http://localhost:8080/services/

The API methods are annoted with:
    @Consumes("application/json")
    @Produces("application/json")

However, when I invoke any service using Json, I get:

|JAXBException occurred : unable to marshal type "..." as an element because it is missing an @XmlRootElement annotation. unable to marshal type "..." as an element because it is missing an @XmlRootElement annotation. |

I'm using wadl2java to generate the api and model classes at server side from the WADL, so there are @XmlAccessorType/@XmlType annotation in my model classes on the server side.

Spring-Boot/CXF seems ignore the provider configured in the Spring configuration XML (which is working perfectly if deployed without Spring Boot to e.g. Jboss/Tomcat): <bean id="jsonProvider" class="com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider" />

How can I set the JacksonJsonProvider to be used by Spring Boot/CXF, or are model classes annotated with @Xml... not supported for Spring Boot/CXF?

Best regards,
Johannes

Reply via email to