zoukankan      html  css  js  c++  java
  • springcloud(Config)五

    1、在码云建个仓库,例如springcloud-config-fortest
    2、然后建一个application.yml,内容如下(为了测试访问例如http://localhost:3344/application-dev.yml)

    spring:
      profiles:
        active: dev
    ---
    spring:
      profiles: dev
      application:
        name: springcloud-config-dev
    ---
    spring:
      profiles: test
      application:
        name: springcloud-config-test
    

    image
    3、在idea新建一个maven项目,springcloud-config-server-3344

    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-config-server</artifactId>
        <version>2.1.1.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    

    4、新建application.yml,内容如下,需要配置git仓库地址

    spring:
      cloud:
        config:
          server:
            git:
              uri: https://gitee.com/zhangpenga/springcloud-config-fortest.git
      application:
        name: springcloud-config-server
    server:
      port: 3344
    

    5、新建主启动类Config_Server_3344,添加config配置@EnableConfigServer
    image
    6、启动Config_Server_3344,

    • 访问http://localhost:3344/application-dev.yml
      image
    • 访问http://localhost:3344/application-test.yml
      image
      ///////////////////////////////////////////////
      application.yml就是仓库里的文件
      image
      其中dev和test分别代表仓库里的spring.profiles=dev
      ///////////////////////////////////////////////

    7、修改仓库里的application.yml,然后push到master,再次访问就是修改之后的文件。

  • 相关阅读:
    OAccflow集成sql
    集成备注
    CCflow与基础框架组织机构整合
    Jeecg_Jflow整合记录
    Problem opening .cshtml files
    The document cannot be opened. It has been renamed, deleted or moved.
    js中!和!!的区别及用法
    hdu 4757 Tree(可持久化字典树)
    Tomcat 学习进阶历程之Tomcat架构与核心类分析
    BZOJ 3000(Big Number-Stirling公式求n!近似值)
  • 原文地址:https://www.cnblogs.com/kaka-qiqi/p/14711412.html
Copyright © 2011-2022 走看看