From 98c35fff62f1d54d804f15d0bc99e520922f4763 Mon Sep 17 00:00:00 2001 From: Rafael da Silva Santos <62489286+Skan90@users.noreply.github.com> Date: Mon, 10 Oct 2022 18:14:35 -0300 Subject: [PATCH] APPLICATION_JSON_UTF8_VALUE is Deprecated From Documentation: "APPLICATION_JSON_UTF8_VALUE Deprecated. as of 5.2 in favor of APPLICATION_JSON_VALUE since major browsers like Chrome now comply with the specification and interpret correctly UTF-8 special characters without requiring a charset=UTF-8 parameter" https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/http/MediaType.html --- .../samples/petclinic/rest/VetRestController.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/springframework/samples/petclinic/rest/VetRestController.java b/src/main/java/org/springframework/samples/petclinic/rest/VetRestController.java index b2fd3ee2..ba3a8e39 100644 --- a/src/main/java/org/springframework/samples/petclinic/rest/VetRestController.java +++ b/src/main/java/org/springframework/samples/petclinic/rest/VetRestController.java @@ -51,7 +51,7 @@ public class VetRestController { @Autowired private ClinicService clinicService; - @RequestMapping(value = "", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @RequestMapping(value = "", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Collection<Vet>> getAllVets(){ Collection<Vet> vets = new ArrayList<Vet>(); vets.addAll(this.clinicService.findAllVets()); @@ -61,7 +61,7 @@ public class VetRestController { return new ResponseEntity<Collection<Vet>>(vets, HttpStatus.OK); } - @RequestMapping(value = "/{vetId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @RequestMapping(value = "/{vetId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Vet> getVet(@PathVariable("vetId") int vetId){ Vet vet = this.clinicService.findVetById(vetId); if(vet == null){ @@ -71,7 +71,7 @@ public class VetRestController { } - @RequestMapping(value = "", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @RequestMapping(value = "", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Vet> addVet(@RequestBody @Valid Vet vet, BindingResult bindingResult, UriComponentsBuilder ucBuilder){ BindingErrorsResponse errors = new BindingErrorsResponse(); HttpHeaders headers = new HttpHeaders(); @@ -85,7 +85,7 @@ public class VetRestController { return new ResponseEntity<Vet>(vet, headers, HttpStatus.CREATED); } - @RequestMapping(value = "/{vetId}", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @RequestMapping(value = "/{vetId}", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Vet> updateVet(@PathVariable("vetId") int vetId, @RequestBody @Valid Vet vet, BindingResult bindingResult){ BindingErrorsResponse errors = new BindingErrorsResponse(); HttpHeaders headers = new HttpHeaders(); @@ -108,7 +108,7 @@ public class VetRestController { return new ResponseEntity<Vet>(currentVet, HttpStatus.NO_CONTENT); } - @RequestMapping(value = "/{vetId}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @RequestMapping(value = "/{vetId}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE) @Transactional public ResponseEntity<Void> deleteVet(@PathVariable("vetId") int vetId){ Vet vet = this.clinicService.findVetById(vetId); -- GitLab