How to return plain text in spring controller?
I want to return a simple plain text string as follows: @RestController @RequestMapping("/test") public class TestController { @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/my", method = RequestMethod.GET, produces="text/plain") public String test() { return "OK"; } Problem: I also have a global ContentNegotiation filter as follows: @Configuration public class ContentNegotiationAdapter extends WebMvcConfigurerAdapter { @Override public void configureContentNegotiation(ContentNegotiationConfigurer configurer) { configurer.favorPathExtension(false) .favorParameter(true)