Spring Boot Actuator Endpoint Model
Spring Boot Actuator exposes operational endpoints for monitoring and managing an application. An endpoint represents a management capability, while its operations define what can be read, changed, or deleted and its exposure determines how clients can access it.
Actuator endpoints are management interfaces for a running Spring Boot application. Common built-in endpoints include `health`, `info`, `metrics`, `env`, `beans`, and `mappings`; their exact availability and behavior depend on the application configuration and Spring Boot version.
An endpoint has an identifier, such as `health`. When exposed over HTTP, the endpoint ID is normally combined with the `/actuator` base path, producing URLs such as `/actuator/health`. The base path can be changed with `management.endpoints.web.base-path`, and individual paths can also be remapped.
Conceptually, an endpoint is separated into operations. A custom `@Endpoint` can declare methods using annotations such as `@ReadOperation`, `@WriteOperation`, and `@DeleteOperation`. Spring Boot can adapt these operations for supported exposure mechanisms such as HTTP and JMX.
Exposure and access are important distinctions. An endpoint can exist in the application without being remotely reachable over HTTP; HTTP exposure is configured separately. Actuator also has security implications because management endpoints can reveal operational or configuration information, so exposed endpoints should be deliberately selected and protected.
The endpoint model is useful because it gives operations teams standardized ways to inspect an application without adding ordinary business REST controllers for management concerns. For example, `health` answers whether the application and its dependencies are healthy, while `metrics` provides access to collected measurements for diagnostic purposes.
Key points
- Actuator endpoints provide operational monitoring and management capabilities.
- An endpoint has an ID and can expose read, write, or delete operations.
- HTTP exposure normally maps an endpoint ID beneath `/actuator`.
- Endpoint exposure and endpoint security/access are separate concerns.
- Custom endpoints can be created with `@Endpoint` and operation annotations.
Interview questions
What is a Spring Boot Actuator endpoint?
An Actuator endpoint is a management interface for inspecting or controlling a running application. Spring Boot provides built-in endpoints such as `health` and `info`, and applications can define custom endpoints. An endpoint has an ID and can expose operations such as reading or changing information. It can be exposed through mechanisms such as HTTP or JMX.
How does `/actuator/health` relate to the Actuator endpoint model?
`health` is the endpoint ID, and `/actuator/health` is its conventional HTTP URL when the default web base path is used. The URL therefore combines the Actuator web base path with the endpoint ID. The base path can be configured, so the actual URL is not necessarily `/actuator/health` in every application.
What are `@ReadOperation`, `@WriteOperation`, and `@DeleteOperation` used for?
They describe the kinds of operations a custom Actuator endpoint supports. A read operation retrieves information, a write operation changes or triggers something, and a delete operation removes something. Spring Boot adapts these operations for supported endpoint exposure technologies.
What is the difference between creating an endpoint and exposing an endpoint?
Creating an endpoint defines a management capability in the application. Exposing it makes that capability reachable through a mechanism such as HTTP or JMX. Therefore, an endpoint can exist without being available through a particular external interface. This separation lets operators control which management capabilities are remotely accessible.
How would you safely expose additional Actuator endpoints in production?
First, expose only the endpoints that operational tooling actually requires rather than treating all endpoints as public APIs. Then apply appropriate authentication and authorization, and consider network isolation such as a separate management port or internal address when appropriate. Sensitive endpoint output should also be reviewed because configuration and environment information can reveal operational details. Spring Boot provides exposure properties and integrates with Spring Security for HTTP endpoint access control.