SpringBoot读取外部配置文件的方法

SpringBoot读取外部配置文件的方法

Spring高级之注解@PropertySource详解(超详细)

 

1、@PropertySource(value = {"classpath:config/user.properties"})

 

2、可以使用@ConfigurationProperties(prefix = "user")或者@Value这种方式

3、使用@Autowired注入Login使用,或者其他方式,比如:https://blog.csdn.net/tyt_XiaoTao/article/details/102842854

posted @ 2021-12-24 15:15  袁骞骞  阅读(744)  评论(0编辑  收藏  举报