Several ways to specify the use of different configuration files in SpringBoot
property file specification
Specify spring.profiles.active = dev in the configuration file
Specify the writing of the yaml file
Use the — symbol in yaml to divide the document block. The picture above is divided into three document blocks. If you do not specify which one to activate, the top document block will be used as the default configuration.
Specify by command line
After typing into a jar package, you can also specify the configuration file to be used when running
Virtual machine parameter specification
固定写法:-Dspring.profiles.active=dev
SpringBoot configuration file loading location
- Command line configuration has the highest priority.
Use command line to modify port number