Springboot2.X 读取多层嵌套的配置结构
示例:
tb:excel:host: http://www.baidu.comtranslation:apikey: aaaareqprefix: http://192.168.0.1:8088/
实现代码:
package com.hiveso.common.config;import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;/*** @Author: coder * @Date: 2025-04-26 15:51* @Version 1.0* @Description: 读取翻译相关配置类*/@Component
@ConfigurationProperties(prefix = "tb")
public class TbConfig {}
源码下载:源码下载