When publishing a springboot project with a jar package, by default, application.properties in the same directory of the jar package will be used as the project configuration file first. However, if a configuration file is specified with-spring.config.location, the specified configuration file is read.
In this regard, we can "move" the configuration files of the springboot project outside the jar package, and then specify that it will use these external configuration files when starting the springboot project.
Here, we can use Java-jardemo-0.01-snapshot to run the project. Normal operation. When we input it into the jar package, application.properties will not be packaged into the jar package. It needs to be copied separately and put in jar package to run normally.
The profile SpringBoot uses the global profile application. Property application. YML。 The function of configuration file is to modify the default value of SpringBoot automatic configuration, which is automatically configured for us at the bottom.
Conventionally, in springboot, you only need to take the properties configured in appolo or nacos.