Springboot multi environment configuration

Programmer light 2022-02-13 07:58:50 阅读数:192

springboot multi environment configuration

0、yml and properties Logically styled

One 、 Create project

In the project resources New China application-dev.properties、application-prod.properties、application-xxxxx.properties

Two 、 Configure multiple environments

stay application.properties Add

spring.profiles.active=dev:dev by application-xxx.properties xxx

If it is spring.profiles.active=prod Then use application-prod.properties The configuration file

copyright:author[Programmer light],Please bring the original link to reprint, thank you. https://en.javamana.com/2022/02/202202130758482345.html