jax rs - Add JSON provider for CXF JAX-RS in Spring Boot properties or YAML file -
how move endpoint.setprovider(new jacksonjsonprovider());
application properties file?
@bean public server rsserver() { jaxrsserverfactorybean endpoint = new jaxrsserverfactorybean(); endpoint.setbus(bus); endpoint.setprovider(new jacksonjsonprovider()); endpoint.setservicebeans(aslist(new customerservicedefault())); endpoint.setaddress("/"); endpoint.setfeatures(aslist(new swagger2feature())); return endpoint.create(); }
first if haven't done already, have add dependency provider:
<dependency> <groupid>org.codehaus.jackson</groupid> <artifactid>jackson-jaxrs</artifactid> <version>1.9.0</version> </dependency>
then need add package jackson entity providers jax-rs scanning (org.codehaus.jackson.jaxrs
in case), other packages created. i'm using yaml configuration , class scanning opposed component scanning, , here how looks:
cxf: path: /services servlet.init: service-list-path: /info jaxrs: classes-scan: true classes-scan-packages: com.yourcompany.package.with.your.handlers,org.codehaus.jackson.jaxrs
Comments
Post a Comment