• springboot打包配置流程以及动态获取运行环境


    1.导入插件

    <packaging>jar</packaging>

    <build>
        <plugins>
            <plugin>
                <!--springbootmaven插件-->
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>1.4.1.RELEASE</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

     

    2.打包

    cmd运行

    mvn clean package install  完成打包

    3.获取运行环境

    spring:
    cloud:
    config:
    uri: http://127.0.0.1:1299 #配置服务器
    label: master #分支
    name: plat-provider-application #github上面名称
    # profile: test #环境
    profile: ${spring.actives.profile} #获取运行的参数


    cmd 输入

    java -jar -Dspring.actives.profile=test xxx-1.0-SNAPSHOT.jar

     

    --测试

    在ereuka7001注册中心查看服务名称即可

  • 相关阅读:
    vue中使用 canvas给页面添加水印
    c++ get keyboard event
    sublime text c++ makefile
    dddd
    songwenxin
    wechat
    ddd
    log
    v3
    xiaoxiaole
  • 原文地址:https://www.cnblogs.com/wgyi140724-/p/10613791.html
Copyright © 2020-2023  润新知