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


      
  

原文地址:https://www.cnblogs.com/rain-in-summer/p/13130037.html