Pessoal, estou tendo um problema com minhas solicitações Rest.
Até um tempo atras meu código estava funcionando normalmente, porem, um a duas semanas atras, minhas requisições param de funcionar, exceto os métodos GET e Delete
GET
@RequestMapping(value = "/api/estabelecimentos", method = RequestMethod.GET, produces = "application/json")
public @ResponseBody List<Estabelecimento> getAllEst() {
return er.findAll();
}
Delete
@RequestMapping(method = RequestMethod.DELETE, value = "/api/estabelecimentos/{id}", produces = "application/json")
public ResponseEntity<Estabelecimento> deleteEst(@PathVariable Long id) {
er.deleteById(id);
return new ResponseEntity<Estabelecimento>(HttpStatus.OK);
}
Os demais métodos (POST e PUT) me retornam erro 415 via client (Postman) e no log do springboot recebo esse retorno;
POST
@RequestMapping(method = RequestMethod.POST, value = "/api/estabelecimentos", produces = "application/json")
public ResponseEntity<Estabelecimento> newEstabelecimento(@RequestBody Estabelecimento estabelecimento) {
er.save(estabelecimento);
return new ResponseEntity<Estabelecimento>(estabelecimento, HttpStatus.OK);
}
PUT
@RequestMapping(method = RequestMethod.PUT, value = "/api/estabelecimentos/{id}", produces = "application/json")
public ResponseEntity<Object> updadeEstabelecimento(@RequestBody Estabelecimento esta, @PathVariable Long id){
Optional<Estabelecimento> estab = er.findById(id);
if(!estab.isPresent())
return ResponseEntity.notFound().build();
esta.setCod_Estabelecimento(id);
er.save(esta);
return ResponseEntity.noContent().build();
}
Log Springboot
14:24:36.716 WARN 14320 --- [nio-8080-exec-1] .c.j.MappingJackson2HttpMessageConverter : Failed to evaluate Jackson deserialization for type [[simple type, class com.api.Entity.Estabelecimento]]: com.fasterxml.jackson.databind.JsonMappingException: Multiple back-reference properties with name 'defaultReference'
2019-05-22 14:24:36.720 WARN 14320 --- [nio-8080-exec-1] .c.j.MappingJackson2HttpMessageConverter : Failed to evaluate Jackson deserialization for type [[simple type, class com.api.Entity.Estabelecimento]]: com.fasterxml.jackson.databind.JsonMappingException: Multiple back-reference properties with name 'defaultReference'
2019-05-22 14:24:36.724 WARN 14320 --- [nio-8080-exec-1] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/json;charset=UTF-8' not supported]
Retorno Clien(Postman)
"timestamp": "2019-05-22T17:24:36.740+0000",
"status": 415,
"error": "Unsupported Media Type",
"message": "Content type 'application/json;charset=UTF-8' not supported",
"trace": "org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/json;charset=UTF-8' not supported\r\n\tat org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodArgumentResolver.readWithMessageConverters(AbstractMessageConverterMethodArgumentResolver.java:224)\r\n\tat org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.readWithMessageConverters(RequestResponseBodyMethodProcessor.java:157)\r\n\tat org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.resolveArgument(RequestResponseBodyMethodProcessor.java:130)\r\n\tat org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgumen
Alguém consegue me dar uma luz ? não consegui encontrar nada na internet