spring mvc通过@RequestMapping("/register")和@ResponseBody返回json格式的字符串时出现如下异常:
The resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request "accept" headers.
控制台没有任何异常信息输出,找了很久发现需要如下包:
jackson-core-asl-1.9.9-redhat-1.jar jackson-jaxrs-1.9.9-redhat-1.jar jackson-mapper-asl-1.9.9-redhat-1.jar spring-web-servlet-3.1.2.RELEASE.jar
如果是eclipse,加入jar包以后记得刷新项目后重启。否则加入的包不一定生效。