首页 技术 正文
技术 2022年11月13日
0 收藏 792 点赞 2,804 浏览 1954 个字

文件的存储方式:

Spring Cloud Config 使用SVN 和 git方式的相关配置

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 和 git方式的相关配置

config server 的 application.yml

spring:
application:
name: app-provider-config
cloud:
config:
server:
git:
uri: git@code.aliyun.com:.............
search-paths: config-repo/div,config-repo/test
username: username
password: password
label: masterlogging:
level:
org.springframework.boot.env.PropertySourcesLoader: TRACE
org.springframework.cloud.config.server: DEBUGserver:
port: 7805
eureka:
client:
serviceUrl:
defaultZone: ...........
instance:
ip-address: true
instance-id: ${spring.application.name}:${spring.application.instance_id:${server.port}}

config client  的 bootstrap.yml

spring:
application:
name: app-provider-ams
cloud:
config:
label: master
uri: http://localhost:7805
discovery:
enabled: true
service-id: app-provider-config
fail-fast: true
profiles:
active: dev
eureka:
client:
serviceUrl:
defaultZone: ..........
instance:
ip-address: true
instance-id: ${spring.application.name}:${spring.application.instance_id:${server.port}}
management:
endpoints:
web:
exposure:
include: refresh,health,info

单点刷新

需要引入

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<version>2.0.5.RELEASE</version>
</dependency>

2.0 版本以上需要加一下

management:
endpoints:
web:
exposure:
include: refresh,health,info

接下来刷新路径是 /actuator/refresh

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,086
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,561
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,410
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,183
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,820
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,903