博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

SpringBoot - 15项目打包与多环境配置

Posted on 2021-01-03 20:44  Kingdomer  阅读(92)  评论(0编辑  收藏  举报

SpringBoot - 15项目打包与多环境配置

(1)项目打包

(1.1)打包插件

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

(1.2)打包

                 

(1.3)运行

 

 

(2)多环境配置

语法结构: application-{profile}.properties/yml

profile: 代表某个配置环境的标识

  • application-dev.properties/yml    开发环境
  • application-test.properties/yml   测试环境
  • application-prod.properties/yml   生产环境

启动方式:

  • java -jar xxx.jar  --spring.profiles.active={profile}