Unable to access Spring Boot Actuator /actuator endpoint
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.
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
Related reading
- Unable to acquire JDBC Connection
- Unable to compile simple Java 10 / Java 11 project with Maven
- Unable to connect Spring AMQP / Rabbit MQ org.springframework.amqp.AmqpConnectException java.net.ConnectException Connection refused connect
- Unable to connect to Kafka run in container from Spring Boot app run outside container
- Unable to add GSI to DynamoDB table using CloudFormation
- Unable to boot device because it cannot be located on disk
- Unable to create call adapter for class example.Simple
- Unable to create new native thread error - but very few threads are in use

OOD Fundamentals
Master object-oriented design from first principles, SOLID, design patterns, and classic interview problems with hands-on coding.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.