我正在学习 Spring Boot/云/微服务,对此我很陌生。
正如标题所示,我无法即时刷新属性。
我正在使用 spring boot 2.0.0.RELEASE 和 spring cloud Finchley.M8,我更新了 bootstrap.properties 如下:
spring.application.name=XXXXX
spring.cloud.config.uri=http://localhost:8888
management.endpoints.web.exposure.include=*
management.security.enabled=false
endpoints.actuator.enabled=true
我正在向 /actuator/refresh
URL 发送 POST 请求,以确保刷新属性。我在配置类上使用 @RefresheScope
。
actuator/refresh
上的发布请求正在返回(我正在使用 postman )
[
"config.client.version",
"updated property on GIT"
]
但是,对我的服务的请求没有获取这些更新的属性。
如果我遗漏了什么,请告诉我。
最佳答案
我有同样的问题,如果你像我一样使用@Value来初始化,也许你可以在你的类中添加一个@RefreshScope。 https://www.devglan.com/spring-cloud/refresh-property-config-runtime这个仅供引用
关于java - Spring Boot-云 :/actuator/refresh working but not able to get the changed values on the fly,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49781335/