fix: 除去多余Long处理设置 vue前段已引入jsonlint处理

pull/26/head
Parker 3 years ago
parent 056f90d369
commit 3e7c89bed1

@ -27,10 +27,6 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@ -70,34 +66,10 @@ public class SpringWebMvcConfig implements WebMvcConfigurer, WebMvcRegistrations
.addPathPrefix(apiPathProperties.getGlobalPrefix(),c -> c.isAnnotationPresent(ApiRestController.class));
}
/**
*
*
* @param registry registry
*/
// @Override
// public void addCorsMappings(CorsRegistry registry) {
// registry.addMapping("/**")
// .allowedOriginPatterns("*")
// .allowedMethods("GET", "HEAD", "POST", "PUT", "DELETE", "OPTIONS")
// .allowedHeaders("*")
// .allowCredentials(true)
// .maxAge(7200);
// }
@Override
public void addInterceptors(InterceptorRegistry registry) {
// 加载特定拦截器
registry.addInterceptor(new UserAuthInterceptor());
WebMvcConfigurer.super.addInterceptors(registry);
}
@Bean
public MappingJackson2HttpMessageConverter getMappingJackson2HttpMessageConverter() {
ObjectMapper objectMapper = Jackson2ObjectMapperBuilder.json()
.serializerByType(Long.class, ToStringSerializer.instance)
.serializerByType(Long.TYPE, ToStringSerializer.instance)
.build();
return new MappingJackson2HttpMessageConverter(objectMapper);
}
}

Loading…
Cancel
Save