springboot的两种配置文件格式:
properties and yaml
当我们初始化一个springboot project的时候 他有下面的结构:
主要就是
application.properties
config-application.properties
src
-main(java folder and resources folder, java folder is for code, resource folder have two properties files)
-test
所以一般有四个properties files. they are default and created when spring boot starts.
但是要注意 我们可以自定义配置文件 而且名字不一定要交application.因为项目是默认去加载名为application的配置文件。如果我们想加载自己的配置文件 那么就需要明确指定:spring.config.location.
是时候彻底搞清楚 Spring Boot 的配置文件 application.properties 了!
注意:pom.xml 是Maven的dependencies文件。like spring framework, Junit etc
application.properties是springboot的配置文件。里面有service name, port, active env…