(四十九)java版spring cloud微服务架构b2b2c电子商务平台-config的简单配置(shh方式)

1、创建项目需要添加的依赖:

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

2、yml文件配置:

server:
port: 8888
spring:
application:
name: cloud-server
cloud:
config:
server:
git:
uri: "git@gitlab.guangbao-uni.com:wangchaojie/SpringCloudConfig.git"
search-paths:respo

3、gitlab的ssh配置:
在~/.ssh目录下,生成公钥和密钥,将密钥设置到gitlab服务器,在config文件里设置一下内容,
Host gitlab.guangbao-uni.com
HostName gitlab.guangbao-uni.com
StrictHostKeyChecking no
Port 52381 #gitlab服务器端口号,不需要可以不写
User wangchaojie
IdentityFile ~/.ssh/id_rsa

具体参数根据实际情况修改

4、git上SpringCloudConfig项目中,在respo目录下有名为config-client-dev.properties的配置文件

5、在浏览器中访问:http://localhost:8888/config-client/dev, 即可返回配置文件的信息

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值