IntellJ IDEA2017 springboot2.0.2中读取配置

IDEA 路径 src\main\resources\application.properties

配置文件名称为 application.properties

默认的位置在classpath根目录下,或者classpath:/config,file:/,file:config/

默认的配置文件名字可以使用
--spring.config.name来指定,只需要指定文件的名字,文件扩展名可以省略


指定文件名称:
--spring.config.name = app
指定文件路径
--spring.config.location=classpath:config/app.properties

指定多个配置文件(不在项目路径下)
--spring.config.location=classpath:config/app.properties,file:C:/usr/tomcatport.properties

相关代码:

             https://github.com/liushaoye/quick_start/tree/second

猜你喜欢

转载自www.cnblogs.com/liuyangfirst/p/9062380.html