springboot——Profile multi-environment configuration

1. Introduction

Profile is Spring's support for different configuration functions in different environments. You can quickly switch the environment by activating and specifying parameters

2. Configuration method

1. Multi-profile file format:

格式:application-{profile}.properties/yml

2.yml supports multiple document blocks

--- You can divide a yml file into multiple documents

3. Activate the specified profile

1. Specify spring.profiles.active = dev in the configuration file

2. Specified on the command line, will overwrite the configuration file configuration

Equivalent to executing in the command window

java -jar spring-boot-02-config-0.0.1-SNAPSHOT.jar --spring.profiles.active=dev

3. Virtual machine parameters

Guess you like

Origin www.cnblogs.com/licha233/p/12716580.html