spring Preparing profiles for different environments

application.properties File configuration

pom file
<!-- Configuration environment profile--> <profiles> <!--dev Default activation , use idea Spring Boot
Configure startup project , need dev Configuration of --> <profile> <id>dev</id> <properties>
<profileActive>dev</profileActive> </properties> <activation>
<activeByDefault>true</activeByDefault> </activation> </profile> <profile>
<id>test</id> <properties> <profileActive>test</profileActive> </properties>
</profile> <profile> <id>prod</id> <properties>
<profileActive>prod</profileActive> </properties> </profile> </profiles>
<build> <finalName>${project.artifactId}</finalName> <resources> <resource>
<directory>src/main/resources</directory> <filtering>true</filtering>
<excludes> <exclude>**/*</exclude> </excludes> </resource> <resource>
<directory>src/main/resources</directory> <filtering>true</filtering>
<includes> <include>application.properties</include>
<include>application-${profileActive}.properties</include> </includes>
</resource> </resources> <plugins> <plugin>
<artifactId>spring-boot-maven-plugin</artifactId> <configuration> <!--
start to fight @SpringBootApplication annotation Path to startup file -->
<mainClass>xx.xx.xx.Application</mainClass> </configuration> </plugin>
</plugins> </build>
* Maven Pack and go command mvn clean install package -Dmaven.test.skip=true -Ptest -P hinder
test It's the one configured above <profileActive> Property value So it can be used smoothly , Use different profiles in different environments .

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