|
@@ -0,0 +1,22 @@
|
|
|
|
|
+package vip.xiaonuo.web.core.config;
|
|
|
|
|
+
|
|
|
|
|
+import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
|
|
+import org.springframework.context.annotation.Bean;
|
|
|
|
|
+import org.springframework.context.annotation.Configuration;
|
|
|
|
|
+import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
|
|
|
|
+import com.fasterxml.jackson.databind.DeserializationFeature;
|
|
|
|
|
+
|
|
|
|
|
+@Configuration
|
|
|
|
|
+public class JacksonConfig {
|
|
|
|
|
+
|
|
|
|
|
+ @Bean
|
|
|
|
|
+ public ObjectMapper objectMapper() {
|
|
|
|
|
+ ObjectMapper mapper = new ObjectMapper();
|
|
|
|
|
+
|
|
|
|
|
+ // ✅ 添加这行即可忽略未知字段
|
|
|
|
|
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
|
|
|
|
+
|
|
|
|
|
+ // ...保留其他已有配置
|
|
|
|
|
+ return mapper;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|