Spring boot - setting default Content-type header if it's not present in request
问题 I'm having the following problem: suppose I sometimes receive POST requests with no Content-type header set. In this case I want to assume that Content-type=application/json by default. Can I achieve this somehow using spring boot features and not using filters? Thanks 回答1: 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(