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 When packaging, you need to obtain the configuration of the corresponding environment , join according to maven
profiles Select the corresponding environment to obtain automatically pom The corresponding environment name parameter configured in Cannot get pom Value problem of

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

That's the general configuration .


©2019-2020 Toolsou All rights reserved,
It's unexpected Python Cherry tree (turtle The gorgeous style of Library ) Some East 14 Pay change 16 salary , Sincerity or routine ? Browser kernel ( understand )java Four functional interfaces ( a key , simple )HashMap Explain in detail html Writing about cherry trees , Writing about cherry trees os Simple use of module