As of Spring Boot 2.x, you need to create a class that extends the WebMvcConfigurer interface, e.g.:
@Configuration
class WebMvcConfiguration implements WebMvcConfigurer {
@Override
public void configureContentNegotiation( ContentNegotiationConfigurer configurer )
{
configurer.defaultContentType( MediaType.APPLICATION_JSON );
}
}
Under 1.x, you could do the same thing with WebMvcConfigurerAdapter, which is now deprecated.
This will affect both request and response bodies, so if you do not have a "produces" parameter explicitly set, and you wanted something other than application/json, it's going to get coerced to application/json.