zoukankan      html  css  js  c++  java
  • SpringBoot配合自动化部署修改内容

    1、修改application.yml配置文件中的profiles.active为变量形式

    spring:
      profiles:
        active: #spring.profiles.active#
    

    2、在pom.xml中增加profiles配置

        <profiles>
            <profile>
                <id>dev</id>
                <properties>
                    <spring.profiles.active>dev</spring.profiles.active>
                </properties>
                <activation>
                    <activeByDefault>true</activeByDefault>
                </activation>
            </profile>
            <profile>
                <id>le-pre</id>
                <properties>
                    <spring.profiles.active>le-pre</spring.profiles.active>
                </properties>
            </profile>
            <profile>
                <id>le-pro</id>
                <properties>
                    <spring.profiles.active>le-pro</spring.profiles.active>
                </properties>
            </profile>
            <profile>
                <id>me-pre</id>
                <properties>
                    <spring.profiles.active>me-pre</spring.profiles.active>
                </properties>
            </profile>
            <profile>
                <id>me-pro</id>
                <properties>
                    <spring.profiles.active>me-pro</spring.profiles.active>
                </properties>
            </profile>
            <profile>
                <id>xye-pre</id>
                <properties>
                    <spring.profiles.active>xye-pre</spring.profiles.active>
                </properties>
            </profile>
            <profile>
                <id>xye-pro</id>
                <properties>
                    <spring.profiles.active>xye-pro</spring.profiles.active>
                </properties>
            </profile>
        </profiles>
    

    3、在pom.xml中增加resources配置

    <build>
            <resources>
                <resource>
                    <directory>src/main/resources</directory>
                    <includes>
                        <include>**/xmldata/*.*</include>
                        <include>**/*.txt</include>
                        <include>**/*.yml</include>
                        <include>**/*.xml</include>
                        <include>**/log4j.properties</include>
                        <include>**/application-${spring.profiles.active}.properties</include>
                    </includes>
                    <filtering>true</filtering>
                </resource>
                <!--<resource>-->
                <!--<directory>src/main/resources.${spring.profiles.active}</directory>-->
                <!--<filtering>false</filtering>-->
                <!--</resource>-->
            </resources>
            <finalName>test-${spring.profiles.active}</finalName>
        </build>
    

    4、在pom.xml中增加properties配置

        <properties>
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
            <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
            <java.version>1.8</java.version>
            <skiptests>true</skiptests>
            <resource.delimiter>#</resource.delimiter>
        </properties>
    

    5、将配置文件统一放到resources.config文件夹中

     6、重启项目



  • 相关阅读:
    事件优先权hdu1873(看病要排队)
    项目包ExpressJS入门指南
    按钮页面ActivityGroup实现Tab效果
    分割范围Codeforces Round #181 (Div. 2)
    随机伪随机随机数字
    数组最小剑指Offer读书笔记之第五章优化时间空间效率
    列字段通用excel导入修改版
    图片区域帧差法识别物体_matlab
    宋体关闭完美退出应用程序
    生成树最小生成树poj 1258 prim
  • 原文地址:https://www.cnblogs.com/songjn/p/13354564.html
Copyright © 2011-2022 走看看