415 Unsupported Media Type with Spring 3.2

后端 未结 5 2114
遇见更好的自我
遇见更好的自我 2020-12-06 08:16

I\'m trying to insert and/or update data into the database using the PUT method via JSON using jQuery 1.6, (Jackson 2.1.1 and Spring 3.

5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-06 08:34

    In the server side, in Spring 3, you need this:

    
    
    
    
        
             
                
             
        
    
    

    Spring 4 uses mappingJackson2HttpMessageConverter. Without AnnotationMethodHandlerAdapter bean declaration, you can also use @RequestBody, while by declaring it we can set mappingJackson2HttpMessageConverter to messageConverters. This is concluded by phenomena that I observed, if wrong please correct.

提交回复
热议问题