Unable to access Spring Boot Actuator /actuator endpoint
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
When the /actuator endpoint returns 404 or 403, the usual causes are: the actuator dependency is missing, endpoints are not exposed over HTTP, Spring Security is blocking access, or the management port/base path has been changed. The fix depends on which issue applies — add the spring-boot-starter-actuator dependency, expose endpoints with management.endpoints.web.exposure.include=*, configure security to permit actuator paths, and check management.server.port and management.endpoints.web.base-path.
Step 1: Add the Dependency
Without this dependency, the /actuator endpoint does not exist.
Step 2: Expose Endpoints
By default, only health and info are exposed over HTTP. To expose all endpoints:
To expose specific endpoints:
Step 3: Configure Spring Security
If Spring Security is on the classpath, it blocks actuator endpoints by default:
For development, permit all actuator endpoints:
Step 4: Check the Base Path
The default base path is /actuator. If it has been changed, you need to use the new path:
Check with:
Step 5: Check the Management Port
Actuator endpoints can be configured to run on a separate port:
Step 6: Enable Specific Endpoints
Some endpoints are disabled by default (like shutdown):
Verification Commands
Full Working Configuration
Troubleshooting Checklist
| Symptom | Cause | Fix |
404 on /actuator | Missing dependency | Add spring-boot-starter-actuator |
404 on /actuator/metrics | Not exposed over HTTP | Set management.endpoints.web.exposure.include |
| 403 Forbidden | Spring Security blocking | Configure SecurityFilterChain to permit actuator paths |
| 404 after config change | Base path changed | Check management.endpoints.web.base-path |
| Connection refused | Different port | Check management.server.port |
Empty response from /actuator | Endpoints disabled | Enable endpoints with management.endpoint.<name>.enabled=true |
Common Pitfalls
- Not quoting the wildcard
*in YAML: In YAML,*is a special character (alias reference). Writinginclude: *without quotes causes a parsing error. Always quote it:include: "*"or useinclude: '*'. - Exposing all endpoints in production without security:
management.endpoints.web.exposure.include=*exposes sensitive information (environment variables, bean definitions, heap dumps). In production, expose onlyhealthandinfo, and protect others with authentication. - Confusing
exposurewithenabled:management.endpoints.web.exposure.includecontrols HTTP visibility.management.endpoint.<name>.enabledcontrols whether the endpoint exists at all. An endpoint must be both enabled and exposed to be accessible. - Using the wrong Spring Security configuration style: Spring Boot 3.x uses
requestMatchers()and lambda-style configuration. OlderantMatchers()andauthorizeRequests()methods are removed. Using the old API causes compilation errors. - Setting
management.server.portand forgetting to update URLs: When actuator runs on a separate port (e.g., 9090), tools, load balancers, and health checks must point to the new port. The application port (8080) no longer serves actuator endpoints.
Summary
- Add
spring-boot-starter-actuatordependency and expose endpoints withmanagement.endpoints.web.exposure.include - Configure Spring Security to permit actuator paths (at minimum
/actuator/health) - Check
management.endpoints.web.base-pathandmanagement.server.portfor custom configurations - Quote the
"*"wildcard in YAML configuration files - In production, expose only necessary endpoints and protect sensitive ones with authentication

