美文网首页
SpringBoot中使用Maven的profile的配置

SpringBoot中使用Maven的profile的配置

作者: linweiyu21 | 来源:发表于2018-05-28 11:20 被阅读0次
    <profiles>
            <profile>
                <id>dev</id>
                <properties>
                    <spring.profiles.active>dev</spring.profiles.active>
                </properties>
                <activation>
                    <activeByDefault>true</activeByDefault>
                </activation>
            </profile>
            <profile>
                <id>test</id>
                <properties>
                    <spring.profiles.active>test</spring.profiles.active>
                </properties>
            </profile>
            <profile>
                <id>prod</id>
                <properties>
                    <spring.profiles.active>prod</spring.profiles.active>
                </properties>
            </profile>
     </profiles>
    
    <build>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                </plugin>
            </plugins>
    
            <filters>
                <filter>src/main/resources/filter/application-${spring.profiles.active}.properties</filter>
            </filters>
            <resources>
                <resource>
                    <directory>src/main/resources</directory>
                    <filtering>true</filtering>
                    <excludes>
                        <exclude>filter/*</exclude>
                    </excludes>
                </resource>
            </resources>
    </build>
    

    注意: SpringBoot中默认的占位符为"@"

    相关文章

      网友评论

          本文标题:SpringBoot中使用Maven的profile的配置

          本文链接:https://www.haomeiwen.com/subject/bdgwjftx.html