在学习Spring cloud config模块时,通常都是跟着官网的Centralized Configuration | quick-start作一遍.html
但在下面这步的时候,出现问题了:git
configuration-client/src/main/resources/bootstrap.properties
spring.application.name=a-bootiful-client
# N.B. this is the default:
spring.cloud.config.uri=http://localhost:8888
management.security.enabled=false
复制代码
最后一句出现了红线,也就是这个无效了。web
若是你无视这个问题,继续往下作:spring
http://localhost:8888/a-bootiful-client/default
来验证config服务器已经知道了改变,你须要调用
refresh
方法来强制客户端去获取新的值.......你能够经过使用
post
方法去请求
http://localhost:8888/refresh
来调用
refresh
方法,而后访问
http://localhost:8080/message
来验证是否生效。
然而当你使用post
方法去请求http://localhost:8888/refresh
时,返回的404。bootstrap
在docs.spring.io | 50.2 Exposing Endpoints这个文档讲到了:bash
management.security.enabled=false
被删除的缘由
这里就不贴表的截图了,能够点击上面的链接详细查看,会发现除了health和info两个支持web访问外,其余的默认不支持web访问。服务器
在bootstrap.properties文件中添加下面的代码 management.endpoints.web.exposure.include=*
app
暴露所有endpoints,你也能够指定须要暴露的endpoints。ide