首页>代码>spring boot通过@ConfigurationProperties注解实现加载application.properties配置,支持多层嵌套语法>/springboot-nested-properties-file/src/main/java/com/hellokoding/util/ZuidaimaProperties.java
package com.hellokoding.util; import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component; @Component @ConfigurationProperties(prefix = "zuidaima") @Data public class ZuidaimaProperties { @Data public static class Site { private String domain; private String name; private String author; } private Site site; }