Helloworld spring-boot project (Part 1.1)
On top of our first helloworld project. Let’s add some interesting spring-boot features.
https://spring.io/guides/gs/actuator-service/
1. Spring Boot Actuator
This plugin can help monitoring the health status of the server status. simply include this to the dependencies part of your build.gradle file:-
compile("org.springframework.boot:spring-boot-starter-actuator")
Then, you can find a list of URL mappings from this URL:-
http://localhost:8080/mappings
You can find a list of end points added by the actuator service. Try it one by one yourselves. They are interesting.
"{[/metrics/{name:.*}],methods=[GET]}": { "bean": "endpointHandlerMapping", "method": "public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.MetricsMvcEndpoint.value(java.lang.String)" }, "{[/metrics],methods=[GET]}": { "bean": "endpointHandlerMapping", "method": "public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()" }, "{[/autoconfig],methods=[GET]}": { "bean": "endpointHandlerMapping", "method": "public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()" }, "{[/dump],methods=[GET]}": { "bean": "endpointHandlerMapping", "method": "public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()" }, "{[/beans],methods=[GET]}": { "bean": "endpointHandlerMapping", "method": "public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()" }, "{[/env/{name:.*}],methods=[GET]}": { "bean": "endpointHandlerMapping", "method": "public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EnvironmentMvcEndpoint.value(java.lang.String)" }, "{[/env],methods=[GET]}": { "bean": "endpointHandlerMapping", "method": "public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()" }, "{[/mappings],methods=[GET]}": { "bean": "endpointHandlerMapping", "method": "public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()" }, "{[/info],methods=[GET]}": { "bean": "endpointHandlerMapping", "method": "public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()" }, "{[/configprops],methods=[GET]}": { "bean": "endpointHandlerMapping", "method": "public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()" }, "{[/trace],methods=[GET]}": { "bean": "endpointHandlerMapping", "method": "public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()" }, "{[/health]}": { "bean": "endpointHandlerMapping", "method": "public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint.invoke(java.security.Principal)" }
2. Change server port and actuate management port.
Add a resource file src/main/resources/application.properties with the following contents:
server.port: 9000 management.port: 9001 management.address: 127.0.0.1
Then, your standalone spring-boot application will be started at the port 9000 instead of the default port 8080. The Spring Actuator management endpoints can only be find at port 9001. e.g. http://localhost:9001/mappings.












