初尝Spring Cloud Config

1,下载源码

     地址https://spring.io/guides/gs/centralized-configuration/

2,导入工程

    解压后分别把Server端与Client端导入到两个Eclipse中,以便测试

3,修改源码中pom.xml为如下形式

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>Finchley.RELEASE</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

4,修改Server端配置,采用本地仓库

spring.cloud.config.server.git.uri=d:/config

5,创建本地仓库

在d:\config目录新增文件a-bootiful-client.properties,文件内容只需一行

message = Hello Terry

在dos下下执行git命令

git init;

git add a-bootiful-client.properties

git commit -m 'first bommit'

6,启动服务端以及客户端,访问http://localhost:92/message,就能看到程序运行结果

 

参照文档:https://spring.io/guides/gs/centralized-configuration/

posted @ 2018-08-07 16:18  Season2009  阅读(119)  评论(0编辑  收藏  举报