zoukankan      html  css  js  c++  java
  • springboot多环境区分

    1.配置文件准备
    2.application.properties
    spring.profiles.active = @profileActive@
    3.pom.xml
    <profiles>
    <!--开发环境-->
    <profile>
    <id>dev</id>
    <properties>
    <profileActive>dev</profileActive>
    </properties>
    </profile>
    <!--测试环境-->
    <profile>
    <id>test</id>
    <properties>
    <profileActive>test</profileActive>
    </properties>
    </profile>
    <!--生产环境-->
    <profile>
    <id>pro</id>
    <properties>
    <profileActive>pro</profileActive>
    </properties>
    </profile>
    </profiles>
     
    <build>
    <resources>
    <resource>
    <directory>src/main/resources</directory>
    <excludes>
    <exclude>application*.properties</exclude>
    </excludes>
    </resource>
    <resource>
    <directory>src/main/resources</directory>
    <!-- 是否替换@xx@表示的maven properties属性值 -->
    <filtering>true</filtering>
    <includes>
    <include>application.properties</include>
    <include>application-${profileActive}.properties</include>
    </includes>
    </resource>
    </resources>
    <plugins>
    <plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    </plugin>
    </plugins>
    </build>
    4.环境选择
     

  • 相关阅读:
    docker容器,镜像常用操作
    微信小程序登录状态
    微信小程序登录流程图
    GET和POST可传递的值到底有多大?
    php发送请求
    thinkphp 导入微信小程序加密解密库
    thinkphp 随机获取一条数据
    bootstrap row 行间距
    webstorm es6 语法报错
    Laravel
  • 原文地址:https://www.cnblogs.com/taohaijun/p/11040242.html
Copyright © 2011-2022 走看看