|
|
@@ -0,0 +1,31 @@
|
|
|
+package platform.config;
|
|
|
+
|
|
|
+import com.fasterxml.jackson.databind.DeserializationFeature;
|
|
|
+import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
+import org.springframework.boot.autoconfigure.web.HttpMessageConverters;
|
|
|
+import org.springframework.context.annotation.Bean;
|
|
|
+import org.springframework.context.annotation.Configuration;
|
|
|
+import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 修复appscan扫出API成批分配问题解决
|
|
|
+ * 参考: https://blog.csdn.net/qq_41835151/article/details/127538276
|
|
|
+ *
|
|
|
+ * @author wangjiang
|
|
|
+ * @date 2023-05-03 20:02:22
|
|
|
+ **/
|
|
|
+@Configuration
|
|
|
+public class JacksonConverters {
|
|
|
+ @Bean
|
|
|
+ public HttpMessageConverters JacksonHttpMessageConverters() {
|
|
|
+ MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter
|
|
|
+ = new MappingJackson2HttpMessageConverter();
|
|
|
+ ObjectMapper objectMapper = new ObjectMapper();
|
|
|
+ //省略其他配置开始
|
|
|
+ //反序列化的时候如果多了其他属性,抛出异常
|
|
|
+ objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true);
|
|
|
+ mappingJackson2HttpMessageConverter.setObjectMapper(objectMapper);
|
|
|
+ //省略其他配置结束
|
|
|
+ return new HttpMessageConverters(mappingJackson2HttpMessageConverter);
|
|
|
+ }
|
|
|
+}
|