使用 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 (将#修改为@)