Specify the configuration file when the spring boot command starts

has the following scenario :

deputy general manager needs to deploy the system. The system is written by spring boot + gradle, but it is written according to the module. It is packaged as war package, and

is used

Java – jar XXX. War

problem comes, database configuration needs to be changed, port needs to be changed, various address changes, but the configuration file is in the package, cannot be changed. So you need to use the command to specify an external configuration file to specify the configuration


java-jar-dspring.config. location=application.yml XXXX. War

command inside the application. The yml in the XXX. The war directory, at the same level can be specified, so that you can use the configuration files outside the inside of the cover off the war file configuration file.

is done.

Read More: