You can create a Spring Resource and return it
@GetMapping(path="/getFields2", produces=MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Resource> getFieldssec(
@Context HttpServletRequest httpServletRequest) {
String text="{"key": "myKey"}";
Resource resource = new ByteArrayResource(text.getBytes());
return ResponseEntity.ok()
.contentLength(text.length())
.contentType(MediaType.APPLICATION_JSON)
.body(resource);
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…