Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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);
- }
- 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 supportedrntat org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodArgumentResolver.readWithMessageConverters(AbstractMessageConverterMethodArgumentResolver.java:224)rntat org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.readWithMessageConverters(RequestResponseBodyMethodProcessor.java:157)rntat org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.resolveArgument(RequestResponseBodyMethodProcessor.java:130)rntat org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgumen
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement