1. Configure profile and build in the pom file
dev true dev 127.0.0.1:8848 DEV 127.0.0.1:8848 DEV test test 127.0.0.1:8848 TEST 127.0.0.1:8848 TEST prod prod 127.0.0.1:8848 PROD 127.0.0.1:8848 PROD src/main/resources true application.yml application-dev.yml application-test.yml src/main/resources true application.yml application-${profiles}.yml
2. Create three files dev\test
3. Bootstrap source file content
spring: profiles: active: test
4. bootstrap-dev content
server: port: 8080 spring: profiles: dev
5. bootstrap-test content
server: port: 8080 spring: profiles: test
6. Switch
The above is the detailed content of How to implement SpringBoot profile multi-environment switching. For more information, please follow other related articles on the PHP Chinese website!