Configured in the previous period springboot A problem in multi environment management , I found a lot of information but didn't give a detailed introduction , Finally, combining with online data to solve , So record it .

First pom build Profiles Corresponding isolation environment name

stay pom In bulid Add to label  resources

resources You need to package the configuration files when you package
<resources> <resource>
<directory>src/main/resources.${activatedProperties}</directory> </resource>
<resource> <directory>src/main/resources</directory> <!--
Without this properties Can't get it pom Value of --> <filtering>true</filtering> </resource> </resources>
 

stay resoruce Create the corresponding environment configuration folder in the level directory ( Folder location can be based on resources Self defined configuration of , It doesn't have to be level ), such as dev/beta/prod

Public documents resources in application.properties When packaging, you need to obtain the configuration of the corresponding environment , join spring.profiles.active=@activatedProperties@ according to maven
profiles Select the corresponding environment to obtain automatically pom The corresponding environment name parameter configured in

 

application.properties Cannot get pom Value problem of

Configured spring.profiles.active=@activatedProperties@ Cannot get pom Of profiles Value problem , stay pom
resource Add under label <filtering>true</filtering> That's it .

That's the general configuration .

 

Technology
©2019-2020 Toolsou All rights reserved,
( Essence )2020 year 6 month 26 day C# Class library Loop execution help class Hackbar Using the tutorial [AndroidO] [RK3399] -- GPIO Drive and control mode Spark SQL- programming Cheats developers apologize inherit jpa Repository Write custom method query The project followed for a year , The customer finally said no Fiddler Simulate request sending and modifying response data ( Essence )2020 year 6 month 26 day C# Class library Enum( Extension method ) Science fiction comes true !“ Trisomy ” Found out