I've just committed a code which adds a jaxrs.classes-scan property, see
https://issues.apache.org/jira/browse/CXF-6869?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15358743#comment-15358743
So you'd do:
jaxrs.classes-scan=true
jaxrs.classes-scan-packages=a.b,c.d
Note it may pick up more providers than you expect, the spring_boot_scan
demo has some Netflix dependencies indirectly importing Jackson, and
while I was experimenting with this new option I saw 2 Jackson providers
being auto-discovered, JacksonJaxbJsonProvider and JacksonJsonProvider.
I see this option being useful as it is less intrusive (no need to add
@Component) but it needs to be used with care as far as auto-discovering
3rd party providers is concerned
Give it a try please
Sergey
On 24/06/16 17:38, Sergey Beryozkin wrote:
Yes, right now the component scan works only on those components which
are marked as Spring @Component or returned from @Bean methods.
I guess this can be further improved. CXF can do it without @Component,
so perhaps it can be done
Cheers, Sergey
On 24/06/16 14:15, Christopher Gardner wrote:
Sergey,
I'm using 3.1.7-SNAPSHOT and have set both properties. Should
3.1.7-SNAPSHOT bring in jackson-jaxrs-json-provider? I had to explicitly
set it as a gradle dependency and construct a JacksonJsonProvider.
* build.gradle
compile group: 'com.fasterxml.jackson.jaxrs', name:
'jackson-jaxrs-json-provider', version: '2.7.5'
* CxfConfig.java
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.adp.vsldh.api.HelloController;
import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
@Configuration
public class CxfConfig {
@Bean
public HelloController hello() {
return new HelloController();
}
@Bean
public JacksonJsonProvider jsonProvider() {
return new JacksonJsonProvider();
}
}
Otherwise, I get the following:
No message body writer has been found for class
com.adp.vsldh.api.GreetingData, ContentType: application/json
On Fri, Jun 24, 2016 at 6:01 AM, Sergey Beryozkin <[email protected]>
wrote:
At the moment 2 properties are supported:
http://cxf.apache.org/docs/springboot.html#SpringBoot-AdditionalConfiguration.1
"cxf.path" can be used to customize a servlet URI pattern,
"cxf.jaxrs.component-scan" can be used to auto-discover the providers -
both properties are used in the demos linked to from CXF wiki.
Use the latter if you'd like Jackson be auto-installed, otherwise create
it directly on the endpoint as one of the demos shows.
Sergey
On 24/06/16 02:39, Christopher Gardner wrote:
Thanks. That helped. Now is there any reference for the following:
* cxf properties that can be set in application.properties
* Examples of configuring Jackson for converting Response entities to
json.
On Thu, Jun 23, 2016 at 4:43 AM, Sergey Beryozkin
<[email protected]>
wrote:
On 23/06/16 00:22, Christopher Gardner wrote:
Has anyone on this list been able to get the
cxf-spring-boot-starter-jaxrs
working with gradle? If so, what did you do?
See a demo done by Vedran,
https://github.com/vpavic-samples/spring-boot-cxf-jaxrs
which has gradle scripts, he has a demo for JAXWS too in case
someone is
interested
Sergey
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/