| | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * Web配置类 |
| | | * |
| | | * @author WWW |
| | | * @date 2024-07-17 |
| | | */ |
| | | @Configuration |
| | | @SuppressWarnings("ALL") |
| | | public class WebConfig extends WebMvcConfigurationSupport { |
| | | /** |
| | | * 跨域请求 |
| | | */ |
| | | @Override |
| | | protected void addCorsMappings(CorsRegistry registry) { |
| | | registry.addMapping("/**") |
| | |
| | | .maxAge(3600); |
| | | } |
| | | |
| | | /** |
| | | * 处理json格式,值null的转换为"" |
| | | */ |
| | | @Override |
| | | public void configureMessageConverters(List<HttpMessageConverter<?>> converters) { |
| | | FastJsonHttpMessageConverter converter = new FastJsonHttpMessageConverter(); |
| | |
| | | SerializerFeature.WriteNullStringAsEmpty, |
| | | SerializerFeature.WriteNullNumberAsZero, |
| | | SerializerFeature.WriteNullBooleanAsFalse); |
| | | // 结果是否格式化,默认为false |
| | | //SerializerFeature.PrettyFormat); |
| | | |
| | | List<MediaType> supportedMediaTypes = new ArrayList<>(); |