java springcloud b2b2c shop 多使用者商城系統原始碼-spring cloud之config的簡單配置(shh方式)
阿新 • • 發佈:2018-12-21
1、建立專案需要新增的依賴:
需要JAVA Spring Cloud大型企業分散式微服務雲構建的B2B2C電子商務平臺原始碼請加企鵝求求 :二一四七七七五六三三
<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: "[email protected]: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, 即可返回配置檔案的資訊