代码拉取完成,页面将自动刷新
Config Server,用于集中管理端服务配置
需要连接外网,来从git拉取服务配置
需要通过application.properties配置git用户和密码
1、配置本地HOST,指向 Eureka Server
2、启动服务
启动脚本:doc/shell/start.sh
sh start.sh
关闭脚本:doc/shell/stop.sh
sh stop.sh
1、添加POM依赖
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
2、配置 bootstrap.properties
# Git分支
spring.cloud.config.label=master
# Config Server
spring.cloud.config.fail-fast=true
spring.cloud.config.discovery.enabled=true
spring.cloud.config.discovery.service-id=demoncat-config-server
3、在GIT的配置管理项目上,创建应用的目录,配置application.properties和application-{profile}.properties
4、配置刷新
1.使用 @RefreshScope 注解读取配置的Bean
2.更新GIT配置
3.刷新配置:curl -XPOST http://localhost:8000/actuator/refresh
1、用户名密码配置错误:检查配置
2、本地仓库有问题:删除项目部署目录下的 local 目录,重新拉取配置
java.lang.IllegalStateException: Cannot load environment
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。