I am trying to enable the actuator endpoints on the same port as the application port (specified in the application.properties file by the server.port=8080) but for some reason, it does not work. When I run the application, I can get back the response from the application but not from the actuator endpoints. I can see the logs mention the endpoints being exposed beneath base path '/actuator' as shown in the screenshot below. But when I try to hit the actuator URL, it gives a 404.
URL, not working:
- http://localhost:8080/actuator
- http://localhost:8080/actuator/health
- http://localhost:8080/actuator/info
However, if I specify a separate port in application.properties for the actuator endpoints with the property (management.server.port=9000) then it works fine.
URL, that's working:
- http://localhost:9000/actuator
- http://localhost:9000/actuator/health
- http://localhost:9000/actuator/info
The only difference is about the port number but from what I read in the spring documentation, the actuator endpoints should by default be enabled on the application port if we don't specify the management.server.port. Can someone please explain what am I missing here? PS: The application run logs are exactly the same with or without specifying the management.server.port, hence, this one screenshot is without specifying the management port. Also, I tried giving the same port number for both the property (server.port and management.server.port) but the same problem occurs. The application works on that port but the actuator endpoints do not. I am using the spring-boot version 2.0.6
These are the contents of my application.properties file:
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
Here are the dependencies in 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>
8080
) "side effect" might be caused bycamel.component.servlet.mapping.context-path=/*
, have you tried the (simple) workaround, setting :management.server.port=8080
(resp.${server.port}
)? – xerx593