spring cloud bus
/buf-refresh能够手动刷新配置,通过webhook 钩子方法 /monitor 无法刷新配置
在application.yml中添加,不要在bootstrap中添加,会启动失败。
spring:
cloud:
bus:
id: ${vcap.application.name:${spring.application.name:application}}:${vcap.application.instance_index:${spring.cloud.config.profile:${local.server.port:${server.port:0}}}}:${vcap.application.instance_id:${random.value}}
参考文章:https://blog.csdn.net/qq_31987435/article/details/96474490
Gateway 网管配置
spring:
cloud:
config:
uri: http://192.168.1.3:8888
profile: dev
label: dev
name: cloud-zookeeper,cloud-gateway
gateway:
routes:
- id: user-service
uri: lb://user-service #lb表示 从注册中心获取
predicates:
- Path=/api/user/** #路由地址 http://user-service/api/user/zhangsan
filters:
- StripPrefix=2 #去掉路由地址前缀/api/user,这里加了2个path所以去掉2个,得到原始地址http://user-service/zhangsan
- id: department-service
uri: lb://department-service
predicates:
Path=/dep/**
filters:
- StripPrefix=1 #去掉路由地址前缀/dep,这里去掉1个,得到原始地址http://department-service/it