配置文件:application.properties

server.port=8080
spring.application.name=xm-test

# Map<String,String>
xm.skuMap.skua001=channela
xm.skuMap.skua002=channelb
xm.skuMap.skub001=channela
xm.skuMap.skuc001=channelc

# Map<String,ChannelInfo>
xm.providerMap.channela.channelCode=channel1
xm.providerMap.channela.aeskey=111111
xm.providerMap.channela.signKey=111

xm.providerMap.channelb.channelCode=channel2
xm.providerMap.channelb.aeskey=222222
xm.providerMap.channelb.signKey=222

xm.providerMap.channelc.channelCode=channel3
xm.providerMap.channelc.aeskey=333333
xm.providerMap.channelc.signKey=333

配置类:PropertiesConfig

/**
 * 参数配置类
 *
 * @author mengxc
 * @date 2023/12/14 15:44
 */
@ConfigurationProperties(prefix = "xm")
@Component
@Data
public class PropertiesConfig {

    /**
     * SKU MAP集合
     */
    private Map<String, String> skuMap;

    /**
     * 供应商 MAP集合
     */
    private Map<String, ChannelInfo> providerMap;

}

测试对象:ChannelInfo

/**
 * 渠道信息
 *
 * @author mengxc
 * @date 2023/12/21 10:45
 */
@Data
public class ChannelInfo {

    /**
     * 渠道编码
     */
    private String channelCode;

    /**
     * AES秘钥
     */
    private String aeskey;

    /**
     * 签名秘钥
     */
    private String signKey;
}

使用测试

/**
 * 测试控制器
 *
 * @author mengxc
 * @date 2023/12/14 15:36
 */
@Slf4j
@RestController
@RequestMapping("/test")
public class TestController {

    @Autowired
    private PropertiesConfig properties;

    /**
     * 测试
     * <br />
     * 地址: http://192.168.0.200:8080/test/t1?name=zhangsan
     *
     * @param name 名称
     * @return 结果
     */
    @GetMapping("/t1")
    public String t1(String name) {
        Map<String, String> skuMap = properties.getSkuMap();
        Map<String, ChannelInfo> providerMap = properties.getProviderMap();
        skuMap.forEach((k, v) -> {
            log.info("=====商品SKU:{},项目编码:{}", k, v);
            ChannelInfo channel = providerMap.get(v);
            log.info("----渠道信息:{}", channel.toString());
        });
        return "ok:共" + skuMap.size() + "个商品SKU";
    }
}