微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

使用 Spring boot 2.5.3

如何解决使用 Spring boot 2.5.3

Spring boot 2.3.8-RELEASE 中,您可以使用相同的动态端口公开 HTTP 上的管理执行器和 HTTPS 上的服务器。当我升级Spring boot 2.5.3 时,管理执行器暴露在 HTTPS 上。 Consul 健康检查失败,因为它在主服务器和管理的同一动态端口上使用 HTTP 而不是 HTTPS

那么对于 Spring boot 2.5.3,我如何配置管理执行器端点以使用 HTTP 并具有与服务器相同的动态端口?

有什么帮助或想法吗?

此配置禁用 HTTP 或 HTTPS 执行器端点

server:
  port: 0 # dynamic port
  ssl.key-store: classpath:keystore.p12
truststore:
  location: classpath:truststore.jks

management:
  ssl.enable: false  
  endpoints:
    web:
      exposure:
        include: health,info,env,configprops
    endpoint:
      health:
        show-details: always

此配置通过 HTTPS 而不是 HTTP 启用执行器

server:
  port: 0 # dynamic port
  ssl.key-store: classpath:keystore.p12
truststore:
  location: classpath:truststore.jks

management:
  server.ssl.enabled: false # actuator still exposed over HTTPs 
  endpoints:
    web:
      exposure:
        include: health,configprops
    endpoint:
      health:
        show-details: always

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。