springboot 快速整合springmvc
核心配置类
在启动类InTheWayApplication上添加@EnableWebMvc注解即可
去除直接返回中文乱码问题
1.增加配置
@Configuration
public class MyConfiguration extends WebMvcConfigurationSupport {
@Bean
public CharacterEncodingFilter characterEncodingFilter(){
CharacterEncodingFilter filter = new CharacterEncodingFilter();
filter.setEncoding("UTF-8");
filter.setForceEncoding(true);
return filter;
}
}
2 . 请求头添加
@GetMapping(value = "/getSeckillPage",produces = "application/json;charset=utf-8")