springboot获取配置文件信息

一.  application.properties或者application.yml文件通过@ConfigurationProperties注解或@Value注解获取配置信息。

二. 自定义的xxx.properties文件获取配置信息方法:
   自定义的类上加上@PropertySource(value={"classpath:xxx.properties"}) 和@ConfigurationProperties(prefix = "xxx")
三. 自定义的xxx.yml文件获取配置信息方法:
   xxxApplication.java中进入对应的bean即可如:
    

 自定义yml文件的获取可参考 https://blog.csdn.net/qq_35754073/article/details/103384685

 


      
  

posted @ 2020-06-15 11:55  Ysoo  Views(529)  Comments(0Edit  收藏  举报