Spingboot startup jar package references external yml configuration file

在运行部署jar包的时候同一个jar多个地方部署,需要修改配置文件,那么把配置文件放在jar外面,可以根据需求进行修改。

Method 1.
Execute the command
java -jar xxxx.jar
1.1 in the jar package directory to create a config peer directory in the current Jar file directory, and put the config peer directory into application.yml

1.2 You can also directly put application.yml in the current Jar file directory
Method 2. Specify the file directory command
Execute the command
java -jar xxxxx.jar --spring.config.location=path (application.yml)

Guess you like

Origin blog.csdn.net/A_awen/article/details/127305031