• org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/json;charset=UTF-8' not supported


    最后找到我的问题,springmvc配置文件中没加 <mvc:annotation-driven/>

    java代码:

    @RequestMapping(value="/requestJsonResposeJson",method=RequestMethod.POST,produces={"application/json;charset=UTF-8"})
      public @ResponseBody TestSupervisorCustomer  requestJsonResposeJson(@RequestBody TestJson testJson) throws Exception

    restclient测试的:

    错误信息:

    org.springframework.web.servlet.DispatcherServlet]DispatcherServlet with name 'springMvc' processing POST request for [/NongyeInfo/userContoller/requestJsonResposeJson.do]
    [org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping]Matching patterns for request [/userContoller/requestJsonResposeJson.do] are [/userContoller/requestJsonResposeJson.*]
    [org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping]URI Template variables for request [/userContoller/requestJsonResposeJson.do] are {}
    [org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping]Mapping [/userContoller/requestJsonResposeJson.do] to HandlerExecutionChain with handler [slc.controller.UserContoller@3c655b15] and 1 interceptor
    [org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerExceptionResolver]Resolving exception from handler [slc.controller.UserContoller@3c655b15]: org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/json;charset=UTF-8' not supported
    [org.springframework.web.servlet.mvc.annotation.ResponseStatusExceptionResolver]Resolving exception from handler [slc.controller.UserContoller@3c655b15]: org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/json;charset=UTF-8' not supported
    [org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver]Resolving exception from handler [slc.controller.UserContoller@3c655b15]: org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/json;charset=UTF-8' not supported
    [org.springframework.web.servlet.DispatcherServlet]Null ModelAndView returned to DispatcherServlet with name 'springMvc': assuming HandlerAdapter completed request handling
    [org.springframework.web.servlet.DispatcherServlet]Successfully completed request
    [org.springframework.beans.factory.support.DefaultListableBeanFactory]Returning cached instance of singleton bean 'sqlSessionFactory'

  • 相关阅读:
    “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift
    webSocket通讯
    动画效果
    史上最简单MySQL教程详解(进阶篇)之视图
    “野生”程序猿写博客一年的感悟
    成都“小甜甜”:她给了男人希望,男人却被嘲笑X丝
    史上最简单MySQL教程详解(进阶篇)之索引及失效场合总结
    SpringBoot简明教程之快速创建第一个SpringBoot应用
    史上最简单MySQL教程详解(进阶篇)之深入理解事务处理内部的动作
    史上最简单MySQL教程详解(进阶篇)之锁与事务处理分离水平(二)
  • 原文地址:https://www.cnblogs.com/mengjinluohua/p/5436511.html
Copyright © 2020-2023  润新知