java - 如何配置 Spring Actuator 与服务在同一端口上运行

标签 java spring spring-mvc

我有一个运行 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.portmanagement.port到8443,我在编译过程中收到以下错误:java.lang.IllegalStateException: Management-specific SSL cannot be configured as the management server is not listening on a separate portLifecycleProcessor 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/

相关文章:

java - 无法分配ServletContext spring 3

Spring MVC : Making multi user friendly

java - HashMap...这里获取 null,我必须重载 hashcode() 以便我各自的对象

java - spring boot 1.5.8.RELEASE导入Java 8编译类

java - java代码中绑定(bind)异常错误的数组索引

spring - spring security内部使用AOP吗?

spring - 如何将 Hadoop 作为 Spring 应用程序测试套件的一部分运行?

spring - 如何在类注解@controller 中获取Spring WebContext

spring-mvc - SpringBoot1.4-我运行IntegrationTest时无法找到@SpringBootConfiguration,在测试错误中使用@ ContextConfiguration/@SpringBootTest(class)

java - 如何终止 JSF 中 Java 方法或 Java 类的运行 (PrimeFaces 3.0)