自己写一个restful的demo的时候遇到一个问题,就是返回错误信息Could not find MessageBodyWriter for response object of type
网上查了半天,说是依赖下面即可
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxb-provider</artifactId>
<version>2.3.4.Final</version>
</dependency>
但是亲测还是不行,本着不抛弃不放弃精神,终于找到解决办法了
原因是通过Resteasy实现的RESTFull服务,在请求后希望返回的结果为json格式的字符串,Resteasy需要Jackson将Java object转换成JSON,所以依赖到resteasy-jackson的包
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jackson-provider</artifactId>
<version>2.3.5.Final</version>
</dependency>
亲测可行。