xuhy
2026-04-18 3dc35915a74fb5e6042981f73830e88f45179b63
xp-robotaxi-push-message-boot/src/main/java/com/xiaopeng/pushMessage/config/MessageLocalConfig.java
@@ -1,13 +1,14 @@
package com.xiaopeng.pushMessage.config;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import org.springframework.boot.autoconfigure.context.MessageSourceProperties;
import org.springframework.boot.autoconfigure.web.WebProperties;
import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ResourceBundleMessageSource;
import org.springframework.util.StringUtils;
import org.springframework.web.servlet.LocaleResolver;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
@@ -59,4 +60,13 @@
//        return new MyLocaleResolver();
//    }
    @Bean
    ObjectMapper om() {
        // 允许对象忽略json中不存在的属性
        ObjectMapper om = new ObjectMapper();
        om.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
        om.registerModule(new JavaTimeModule());
        return om;
    }
}