SpringBoot: multi-environment testing and switching spring.profile.active

In the default properties file, add spring.profile.active = dev, you can specify the load application-dev.properties file. Note: Specify a different configuration file in the main configuration, the configuration file name can not recklessly, are application- ××× .properties

yml configuration file other environments, need --- separated, as shown in FIG targeting. The first server.port is loaded by default, if the inside active: test, test section will be activated, the programmer is running, port is 8885. Note: If you application.properties commented, reads the other properties files and properties in a higher priority than yml. 

other methods:

1. By operating parameters specified environment

2. Specify environment parameters by vm

Published 126 original articles · won praise 7 · views 10000 +

Guess you like

Origin blog.csdn.net/qq_36880027/article/details/104381101