I see two options:
If the type of content you want is static, you can add it to @RequestMapping, for example.
@RequestMapping(value="...", produces="text/plain")
, HTTP- Accept. . 16.3.2.5 .
ResponseEntity,
@RequestMapping("/something")
public ResponseEntity<String> handle() {
HttpHeaders responseHeaders = new HttpHeaders();
responseHeaders.setContentType(new MediaType("text", "plain"));
return new ResponseEntity<String>("Hello World", responseHeaders, HttpStatus.CREATED);
}
MediaType mime, , . MediaType.TEXT_PLAIN.
. 16.3.3.6 HttpEntity<?>