@ConfigurationProperties和@PropertySource

@ConfigurationProperties填充对象属性,它默认是从application.yml或application.properties上读,需要作为一个bean,所以还要加@Component或在配置类上加@Bean。

如果要指定配置文件就要加@PropertySource
@PropertySource(value = {"classpath:person.properties"})

https://blog.csdn.net/qq78442761/article/details/88115060

posted @ 2021-08-21 21:31  ??,uunu  阅读(47)  评论(0编辑  收藏  举报