首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

当server.port和management.port不同时,无法让/refresh与spring-cloud-client一起工作

server.portmanagement.port不同时,会导致/refreshspring-cloud-client无法正常工作的问题。

server.port是Spring Boot应用程序的主要端口,用于处理外部请求。而management.port是用于管理和监控Spring Boot应用程序的端口,通常用于暴露一些管理接口和健康检查等功能。

server.portmanagement.port不同时,/refresh请求会发送到server.port端口,而spring-cloud-client会尝试通过management.port端口来获取应用程序的配置信息。由于两个端口不同,导致/refresh请求无法正确获取到配置信息,从而无法实现配置的动态刷新。

为了解决这个问题,可以通过以下几种方式来配置server.portmanagement.port相同:

  1. application.propertiesapplication.yml中添加以下配置:
  2. application.propertiesapplication.yml中添加以下配置:
  3. 这样配置后,server.portmanagement.port都将使用相同的端口号,从而解决/refreshspring-cloud-client不工作的问题。
  4. 使用命令行参数来指定端口:
  5. 使用命令行参数来指定端口:
  6. 通过在启动命令中指定server.portmanagement.server.port参数,同样可以使两个端口相同。

总结: 当server.portmanagement.port不同时,可以通过配置文件或命令行参数来使两个端口相同,从而解决/refreshspring-cloud-client不工作的问题。

腾讯云相关产品和产品介绍链接地址:

  • 腾讯云服务器(CVM):https://cloud.tencent.com/product/cvm
  • 腾讯云云原生应用平台(TKE):https://cloud.tencent.com/product/tke
  • 腾讯云数据库(TencentDB):https://cloud.tencent.com/product/cdb
  • 腾讯云对象存储(COS):https://cloud.tencent.com/product/cos
  • 腾讯云区块链服务(Tencent Blockchain):https://cloud.tencent.com/product/tencent-blockchain
页面内容是否对你有帮助?
有帮助
没帮助

相关·内容

没有搜到相关的合辑

领券