Administrator
6 days ago d578b1b228d41529294d1ecb7bf2b63d77fd809a
fix(gateApi): 忽略Gate配置反序列化未知属性

- 引入 DeserializationFeature 导入
- 调整 ObjectMapper 初始化逻辑
- 禁用遇到未知属性时抛出异常的配置
- 增强 JSON 配置文件反序列化的容错性
1 files modified
5 ■■■■■ changed files
src/main/java/com/xcong/excoin/modules/gateApi/GateConfigPersistenceService.java 5 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/gateApi/GateConfigPersistenceService.java
@@ -1,6 +1,7 @@
package com.xcong.excoin.modules.gateApi;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.SerializationFeature;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@@ -25,7 +26,9 @@
    private static final String CONFIG_PREFIX = "gate-config-";
    private static final String JSON_SUFFIX = ".json";
    private final ObjectMapper mapper = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT);
    private final ObjectMapper mapper = new ObjectMapper()
            .enable(SerializationFeature.INDENT_OUTPUT)
            .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
    @PostConstruct
    public void ensureConfigDir() {