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'

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM