Согласно javadoc for org.springframework.web.bind.annotation.requestmapping#Produes
< /blockquote>
Однако в моем примере контроллера ниже: < /p>
Код: Выделить всё
@RestController
@RequestMapping(produces = MediaType.APPLICATION_JSON_VALUE)
public class MediaTypeDemoController {
@GetMapping("/json")
public ResponseEntity getJsonResponse() {
Map response = Map.of("message", "This is JSON");
return ResponseEntity.ok(response);
}
@GetMapping(value = "/xml", produces = MediaType.APPLICATION_XML_VALUE)
public ResponseEntity getXmlResponse() {
String xml = "This is XML";
return ResponseEntity.ok(xml);
}
}
обновление:
исправлено https://github.com/springdoc/springdoc- ... /pull/3026
Подробнее здесь: https://stackoverflow.com/questions/796 ... -generatin