Java 弹簧执行器端点在应用程序端口上不工作

Java 弹簧执行器端点在应用程序端口上不工作,java,spring,spring-boot,port,spring-boot-actuator,Java,Spring,Spring Boot,Port,Spring Boot Actuator,我试图在与应用程序端口相同的端口上启用执行器端点(由server.port=8080在application.properties文件中指定),但由于某些原因,它无法工作。当我运行应用程序时,我可以从应用程序返回响应,但不能从执行器端点返回响应。我可以看到日志中提到的端点暴露在基本路径“/actuator”下面,如下面的屏幕截图所示。但当我尝试点击执行器URL时,它给出了404 URL,不工作: :8080/执行器 :8080/执行器/健康 :8080/exactor/info 但是,如果我

我试图在与应用程序端口相同的端口上启用执行器端点(由server.port=8080在application.properties文件中指定),但由于某些原因,它无法工作。当我运行应用程序时,我可以从应用程序返回响应,但不能从执行器端点返回响应。我可以看到日志中提到的端点暴露在基本路径“/actuator”下面,如下面的屏幕截图所示。但当我尝试点击执行器URL时,它给出了404

URL,不工作

  • 8080/执行器
  • 8080/执行器/健康
  • 8080/exactor/info
但是,如果我在application.properties中为具有属性(management.server.port=9000)的执行器端点指定一个单独的端口,那么它可以正常工作

URL,这是工作的

  • 9000/执行器
  • 9000/执行器/健康
  • 9000/exactor/info
唯一的区别在于端口号,但从我在spring文档中读到的内容来看,如果我们没有指定management.server.port,那么默认情况下应该在应用程序端口上启用执行器端点。 有人能解释一下我遗漏了什么吗? PS:应用程序运行日志完全相同,无论是否指定management.server.port,因此,此屏幕截图没有指定管理端口。 此外,我尝试为属性(server.port和management.server.port)提供相同的端口号,但出现了相同的问题。应用程序在该端口上工作,但执行器端点不工作。 我使用的是spring boot版本2.0.6

以下是my application.properties文件的内容:

camel.springboot.main-run-controller=true
camel.springboot.name=AppName
camel.rest.data-format-property.prettyPrint=false
camel.component.servlet.mapping.context-path=/*

server.port=8080
management.server.port=9000

management.endpoint.health.show-details=always
management.endpoint.beans.enabled=true

logging.level.org.springframework = INFO
logging.level.org.apache.camel.spring.boot = INFO
logging.level.org.apache.camel.impl = DEBUG
以下是pom.xml中的依赖项:

<dependencies>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-spring-boot-starter</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-tomcat</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-undertow</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-servlet-starter</artifactId>
        </dependency>
</dependencies>

org.apache.camel
驼形弹簧靴起动器
org.springframework.boot
弹簧靴起动器执行器
org.springframework.boot
SpringBootStarterWeb
org.springframework.boot
弹簧启动机tomcat
org.springframework.boot
弹簧靴起动器下拖
org.apache.camel
骆驼起动器

关于弹簧防尘套执行器

通过使用默认HTTP端口公开管理端点是 基于云的部署的明智选择。但是,如果 应用程序在您自己的数据中心内运行,您可能更愿意公开 通过使用不同的HTTP端口创建端点

它使用默认HTTP端口(8080)为执行器提供服务。我做了一个快速检查,可以用SpringBoot2.1.X和2.2.X确认这一点


尝试从配置中删除
管理.port
,如果此操作不起作用,则问题可能来自应用程序中的其他(自定义)配置。

请在application.properties文件中设置以下内容

management.endpoints.enabled-by-default=true 

management.endpoints.web.exposure.include=*  

请从pom.xml/gradle.build中添加完整的application.properties文件或github链接?和spring引导版本以及依赖项file@dgebert添加了application.properties文件我认为(
8080
)“副作用”可能是由
camel.component.servlet.mapping.context path=/*
引起的,您尝试过(简单)解决方法,设置:
management.server.port=8080
(分别为
${server.port}
)?感谢@rieckpil的回答,我也用另一个虚拟spring应用程序证实了这一点,但是,删除management.port并不能使其工作。此外,应用程序中没有其他可能影响健康端点的自定义配置。感谢您的建议,但这仍然没有改变任何事情有同样的问题。