|
@@ -26,9 +26,13 @@
|
|
|
|
|
|
package com.persagy.server.syn
|
|
|
|
|
|
+import com.alibaba.fastjson.PropertyNamingStrategy
|
|
|
import com.persagy.service.interceptors.SPageInterceptor
|
|
|
+import com.persagy.service.json.SJsonHttpMessageConverter
|
|
|
import org.slf4j.LoggerFactory
|
|
|
import org.springframework.context.annotation.Configuration
|
|
|
+import org.springframework.http.converter.HttpMessageConverter
|
|
|
+import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
|
|
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry
|
|
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
|
|
|
|
|
@@ -49,4 +53,19 @@ open class WebMvcConfg: WebMvcConfigurerAdapter() {
|
|
|
super.addInterceptors(registry)
|
|
|
|
|
|
} // Function addInterceptors()
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 配置 json 转换使用 FastJson
|
|
|
+ *
|
|
|
+ * @param converterList 转换器列表
|
|
|
+ */
|
|
|
+ override fun configureMessageConverters(converterList: MutableList<HttpMessageConverter<*>>) {
|
|
|
+ // 先把JackSon的消息转换器删除.
|
|
|
+ converterList.removeIf { item -> item is MappingJackson2HttpMessageConverter }
|
|
|
+
|
|
|
+ val converter = SJsonHttpMessageConverter()
|
|
|
+ // 设置 Json 序列化,属性首字母小写
|
|
|
+ converter.propertyNamingStrategy = PropertyNamingStrategy.CamelCase
|
|
|
+ converterList.add(converter)
|
|
|
+ }
|
|
|
} // Class WebMvcConf()
|