springboot 2.x相关配置
1、在配置文件中进行配置
#############指定项目中所有的日期类型返回json格式########### spring.jackson.date-format=yyyy-MM-dd HH:mm:ss spring.jackson.serialization.write-dates-as-timestamps=false ############设置空值不返回################################ #spring.jackson.default-property-inclusion=non_null
##############设置文件上传大小############
spring.servlet.multipart.max-file-size = 1073741824
spring.servlet.multipart.max-request-size = 10737418240
2、注册拦截器需要实现WebMvcConfigurer
@Configuration public class WebAppConfig implements WebMvcConfigurer { @Autowired private HeaderInterceptor headerInterceptor; @Override public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(headerInterceptor).addPathPatterns("/**"); } }