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,
C#/.NET System optimization (redis Chapter 6 data structure 【List】) inherit jpa Repository Write custom method query CCTV :Tiktok A lawsuit shows the attitude and determination of safeguarding rights mybatis Return result mapping of series ( Essence )2020 year 8 month 2 day TypeScript The use of generics vue Value transfer between parent-child and non parent-child components golang One line of code converts the slice into a semicolon separated string mysql Recursively finds all child nodes of the parent class ( Essence )2020 year 6 month 26 day C# Class library Enum( Extension method )SpringMVC Frame in controller Layer gets the property value of the custom configuration file