1. 程式人生 > >Spring Cloud Config 使用SVN方式的相關配置

Spring Cloud Config 使用SVN方式的相關配置

oca pen cal info 技術分享 repo def com hot

文件的存儲方式:

技術分享圖片

1、使用svn 當做配置中心 config server的配置方式:

引入svn的包

<dependency>
   <groupId>org.tmatesoft.svnkit</groupId>
   <artifactId>svnkit</artifactId>
   <version>1.8.10</version>
</dependency>

修改application.yml

我的svn路徑是 http://ip:port/svn/mogo/Coding/app-hotpoint-parent/app-global-config/config-repo

spring:
  application:
    name: app-provider-config
  cloud:
    config:
      enabled: true
      server:
        svn:
          uri: http://ip:port/svn/mogo/Coding/app-hotpoint-parent/app-global-config
          username: username
          password: password
          default-label: config-repo
  profiles:
    active: subversion

config client 的配置

bootstrap.yml

spring:
  application:
    name: config-client  # 這裏要跟文件(config-client-dev.yml)的前面的application段相同
  cloud:
    config:
      label: config-repo
      uri: http://localhost:7805
      name: config-client
  profiles:
    active: dev

至於其余的端口什麽的,放在application.yml中即可

2、使用git 當做文件存儲方式

Spring Cloud Config 使用SVN方式的相關配置