【发布时间】:2020-11-01 19:29:46
【问题描述】:
我正在尝试使用本地文件系统设置 spring 配置云。
以下是我在云服务器上的配置。
server.port=8888
spring.profiles.active=native
spring.cloud.config.server.native.searchLocations=classpath:/
客户端应用上的Bootstrap.properties如下所示
spring.application.name=hello-world
spring.cloud.config.uri=http://localhost:8888
management.endpoints.web.exposure.include=*
我还在类路径上为 hello-world spring boot 应用程序创建了 hello-world.yml,属性为 test: Hello World
按照以下步骤使用配置服务器。
-
第一步:更新配置文件并启动云配置服务器。能够 见配置
http://localhost:8888/hello-world/default -
第 2 步:启动客户端应用程序
hello-world,客户端应用程序能够读取test来自云配置服务器的属性文件。 -
第 3 步:通过更新
test: Good Bye来更改配置 hello-world.yaml。此时,如果我检查
http://localhost:8888/hello-world/default,它仍然显示旧值。 -
第 4 步:在客户端应用程序上运行
/actuator/refresh。但它不会检测到 配置服务器上的任何更改。
仅当我重新启动云配置服务器时才会反映新的更改。 是否有任何配置问题导致云配置服务器无法监听更改?
我可以在云配置应用程序上看到o.s.cloud.commons.util.InetUtils : Cannot determine local hostname INFO 登录。
【问题讨论】:
标签: spring spring-boot spring-cloud spring-cloud-config