@Component @Data @ConfigurationProperties(prefix = "person") public class Person{ private String id; private String name; } }
@ConfigurationProperties括号中的prefix值即为application.yml文件中的前缀
#Person Info person: id: student name: aaa
在之后的运用中,可直接调用Person类(放在common/property中),可避免代码冗余