我有一个运行 https://localhost:8443
的 Spring boot 应用程序。我正在尝试让 Spring 执行器在同一端口上工作。现在,我正在处理https://localhost:420/health
但问题是它在不同的端口上工作,而不是在端口 8443 上工作。这是我在 application.properties
中的配置:
server.port=69
server.ssl.enabled=true
server.ssl.key-store=classpath:keystores/keys.jks
server.ssl.key-password=string
management.port=420
management.ssl.enabled=true
management.ssl.key-store=classpath:keystores/keys.jks
management.ssl.key-password=string
当我尝试同时更改两者时 server.port
和management.port
到8443,我在编译过程中收到以下错误:java.lang.IllegalStateException: Management-specific SSL cannot be configured as the management server is not listening on a separate port
和LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@194bcebf: startup date [Thu Jun 15 11:48:57 BST 2017]; root of context hierarchy
如果有用的话,Spring boot 应用程序由 spring boot、jetty 和 apache Camel 组成。
最佳答案
如果您希望执行器使用与服务器端口相同的端口,您可以删除管理端口属性。我们的项目中有执行器,但我们没有任何特定的管理端口,我们可以访问服务器端口本身上的执行器端点。
关于java - 如何配置 Spring Actuator 与服务在同一端口上运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44566215/