Hi
To be honest I'm not sure traditional Spring XML configuration files are
even supported with Spring Boot ? (XML is the old citizen, properties is
the new citizen :-)), but if it is then let me know how.
Are you using CXF 3.1.7 Spring Boot starter ?
I think you need to have a @Bean method returning
new JacksonJsonProvider()
It can also be auto-scanned - but I found in my experiments that
muiltiple Jackson providers can be picked up, so I'd rather return an
instance from the code
Sergey
On 17/08/16 17:40, J. Fiala wrote:
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
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/