I have a Java Spring Boot Application, which is currently running on http://localhost:8080. I will be containerising this application to be deployed in Kubernetes. For this I have enabled the actuator health
endpoint by adding the following to the pom.xml
file.
<!-- Spring boot actuator to expose metrics endpoint -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
Now, the application Health Endpoint works successfully on http://localhost:8080/actuator/health endpoint. I wish to change the PORT of the Health Endpoint URL to be 8081. (This is to ensure that I can expose 8080 port to the public and expose 8081 port only to the load balancer. This is a personal preference)
How can I change the port of the Health Endpoint so that the health endpoint URL becomes http://localhost:8081/actuator/health, and the application runs on http://localhost:8080/.