When I try to post new object with post method. RequestBody could not recognize contentType. Spring is already configured and POST could work with others objects, but not th
I met the same problem which i solved by deserializing myself the posted value :
@RequestMapping(value = "/arduinos/commands/{idArduino}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public String sendCommandesJson(@PathVariable("idArduino") String idArduino, HttpServletRequest request) throws IOException {
// getting the posted value
String body = CharStreams.toString(request.getReader());
List commandes = new ObjectMapper().readValue(body, new TypeReference>() {
});
with theses gradle dependencies :
compile('org.springframework.boot:spring-boot-starter-web')
compile('com.google.guava:guava:16.0.1')