|
|
|
@ -1,13 +1,21 @@ |
|
|
|
package cn.chjyj.szwh.configure; |
|
|
|
|
|
|
|
import cn.chjyj.szwh.Interceptor.ChInterceptor; |
|
|
|
import com.alibaba.fastjson.serializer.SerializerFeature; |
|
|
|
import com.alibaba.fastjson.support.config.FastJsonConfig; |
|
|
|
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter; |
|
|
|
import org.apache.commons.logging.Log; |
|
|
|
import org.apache.commons.logging.LogFactory; |
|
|
|
import org.springframework.context.annotation.Bean; |
|
|
|
import org.springframework.context.annotation.Configuration; |
|
|
|
import org.springframework.http.MediaType; |
|
|
|
import org.springframework.http.converter.HttpMessageConverter; |
|
|
|
import org.springframework.web.servlet.config.annotation.CorsRegistry; |
|
|
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; |
|
|
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; |
|
|
|
|
|
|
|
import java.util.Arrays; |
|
|
|
|
|
|
|
/** |
|
|
|
* 配置基础信息 |
|
|
|
*/ |
|
|
|
@ -30,4 +38,18 @@ public class ChWebMvcConfigurer implements WebMvcConfigurer { |
|
|
|
registry.addMapping("/**") |
|
|
|
.allowedMethods("POST","GET"); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* fast json 字符串转义 |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Bean |
|
|
|
public HttpMessageConverter fastConvert(){ |
|
|
|
FastJsonHttpMessageConverter converter = new FastJsonHttpMessageConverter(); |
|
|
|
FastJsonConfig config = new FastJsonConfig(); |
|
|
|
config.setSerializerFeatures(SerializerFeature.WriteSlashAsSpecial); |
|
|
|
converter.setFastJsonConfig(config); |
|
|
|
converter.setSupportedMediaTypes(Arrays.asList(MediaType.APPLICATION_JSON)); |
|
|
|
return converter; |
|
|
|
} |
|
|
|
} |
|
|
|
|