首页>代码>spring boot通过@ConfigurationProperties注解实现加载application.properties配置,支持多层嵌套语法>/springboot-nested-properties-file/src/main/java/com/hellokoding/util/NestedProperties.java
package com.hellokoding.util; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component; @Component @ConfigurationProperties(prefix = "nested") public class NestedProperties { public static class A { private String b; public String getB() { return b; } public void setB(String b) { this.b = b; } } private A a; public A getA() { return a; } public void setA(A a) { this.a = a; } }