From 62e604dad492c71311ebef36b6226d92facffff9 Mon Sep 17 00:00:00 2001 From: Rafael da Silva Santos <62489286+Skan90@users.noreply.github.com> Date: Mon, 10 Oct 2022 18:13:31 -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 --- .../petclinic/rest/SpecialtyRestController.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/springframework/samples/petclinic/rest/SpecialtyRestController.java b/src/main/java/org/springframework/samples/petclinic/rest/SpecialtyRestController.java index 4ee88292..dc7f586f 100644 --- a/src/main/java/org/springframework/samples/petclinic/rest/SpecialtyRestController.java +++ b/src/main/java/org/springframework/samples/petclinic/rest/SpecialtyRestController.java @@ -51,7 +51,7 @@ public class SpecialtyRestController { @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<Specialty>> getAllSpecialtys(){ Collection<Specialty> specialties = new ArrayList<Specialty>(); specialties.addAll(this.clinicService.findAllSpecialties()); @@ -61,7 +61,7 @@ public class SpecialtyRestController { return new ResponseEntity<Collection<Specialty>>(specialties, HttpStatus.OK); } - @RequestMapping(value = "/{specialtyId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @RequestMapping(value = "/{specialtyId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Specialty> getSpecialty(@PathVariable("specialtyId") int specialtyId){ Specialty specialty = this.clinicService.findSpecialtyById(specialtyId); if(specialty == null){ @@ -71,7 +71,7 @@ public class SpecialtyRestController { } - @RequestMapping(value = "", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @RequestMapping(value = "", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Specialty> addSpecialty(@RequestBody @Valid Specialty specialty, BindingResult bindingResult, UriComponentsBuilder ucBuilder){ BindingErrorsResponse errors = new BindingErrorsResponse(); HttpHeaders headers = new HttpHeaders(); @@ -85,7 +85,7 @@ public class SpecialtyRestController { return new ResponseEntity<Specialty>(specialty, headers, HttpStatus.CREATED); } - @RequestMapping(value = "/{specialtyId}", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @RequestMapping(value = "/{specialtyId}", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Specialty> updateSpecialty(@PathVariable("specialtyId") int specialtyId, @RequestBody @Valid Specialty specialty, BindingResult bindingResult){ BindingErrorsResponse errors = new BindingErrorsResponse(); HttpHeaders headers = new HttpHeaders(); @@ -103,7 +103,7 @@ public class SpecialtyRestController { return new ResponseEntity<Specialty>(currentSpecialty, HttpStatus.NO_CONTENT); } - @RequestMapping(value = "/{specialtyId}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @RequestMapping(value = "/{specialtyId}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE) @Transactional public ResponseEntity<Void> deleteSpecialty(@PathVariable("specialtyId") int specialtyId){ Specialty specialty = this.clinicService.findSpecialtyById(specialtyId); -- GitLab