IDEA SpringMVC 返回json格式的时候 Err:406

为什么80%的码农都做不了架构师?>>>   hot3.png

【代码:Spring Control】

@Controller
@RequestMapping(value = "/User", method = RequestMethod.GET)
public class UserControl {

    @RequestMapping(value = "/test")
    public @ResponseBody Map test() {
        System.out.println("  # --> spring test");
        HashMap hashMap = new HashMap<>();
        hashMap.put("kk", "3306");
        return hashMap;
    }
}

【Err:406】

HTTP Status 406 -
type Status report
message
description The resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request "accept" headers.
Apache Tomcat/6.0.43

【解决方法①】

导入 jackson的lib // 因为spring返回json是调用第三方库-jackson完成的

200555_cdYK_1986459.png

转载于:https://my.oschina.net/Moy/blog/419299

你可能感兴趣的:(json,开发工具,java)