java - Spring Boot-云 :/actuator/refresh working but not able to get the changed values on the fly

标签 java spring spring-boot spring-cloud

我正在学习 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/

相关文章:

java - JPA 使用 Map<ID, Entity> 而不是 List<Entity>

java - 无法映射具有多对多关系的不同实体的字段

java - 无法为同一切面类的方法设置建议

java - 切换为 goto 语句还是个案检查器?

Spring WS 的 JavaScript 客户端

java - 使用spring boot使用gmail smtp发送邮件

java - Spring 启动: How to convert thymeleaf to jsp

Java String 一次删除一个字母

java - 在多个对象之间创建其他人可以搜索的松散关系

spring - 当请求正文未通过使用 Bean Validation/Hibernate Validator 定义的验证时,如何返回自定义响应 pojo?