• 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、重启项目



  • 相关阅读:
    个人软件过程详细需求分析
    班级网站分析
    PSP个人软件开发系统面向对象需求分析与设计文档
    Psp个人软件开发软件需求分析及用例分析
    上海期货交易所数据备份软件项目前景与范围文档
    vmware虚拟机与主机连接
    c#实现截取电脑全屏
    求一串数组的最大的子数组的和 孔祥安AND杨霏
    多路电梯调度问题 杨霏AND孔祥安
    分析文件中频率出现最多的前十个词
  • 原文地址:https://www.cnblogs.com/songjn/p/13354564.html
Copyright © 2020-2023  润新知