Quick revision
The short answer
By default only the health endpoint is exposed over HTTP, so /actuator/metrics returns 404 even though the endpoint exists. We expose more with management.endpoints.web.exposure.include, for example health,info,metrics. Exposure, whether an endpoint is reachable over HTTP or JMX, is separate from access control on the endpoint itself, which since Boot 3.4 is set with management.endpoint.<id>.access and management.endpoints.access.default, replacing the old enabled properties.
What to remember
In this answer, we saw that /actuator/metrics returns 404 because only the health endpoint is exposed over HTTP by default. management.endpoints.web.exposure.include exposes the endpoints we list, such as health,info,metrics. Exposure is separate from access control, which since Boot 3.4 uses management.endpoint.<id>.access and management.endpoints.access.default with none, read-only and unrestricted, replacing the old enabled properties, and both are separate from Spring Security's rules about who may call.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
By default only the health endpoint is exposed over HTTP, so /actuator/metrics returns 404 even though the endpoint exists. We expose more with management.endpoints.web.exposure.include, for example health,info,metrics. Exposure, whether an endpoint is reachable over HTTP or JMX, is separate from access control on the endpoint itself, which since Boot 3.4 is set with management.endpoint.<id>.access and management.endpoints.access.default, replacing the old enabled properties.
Why this question is asked
Adding Actuator and finding that most of its endpoints return 404 is almost a rite of passage for Spring Boot developers. The behaviour is deliberate: Actuator endpoints can reveal configuration, environment variables and memory contents, so Boot exposes as little as possible until we decide otherwise. Interviewers ask this to check that we know the two separate switches involved and how they changed in recent versions. In this answer, we will recap what an endpoint is, see why metrics is hidden, expose it, and then separate exposure from access with the Boot 3.4 properties.
1A Quick Recap of Actuator Endpoints
spring-boot-starter-actuator adds production features to an application, and each feature is an endpoint with an id: health, info, metrics, env, loggers, heapdump and others. An endpoint is a piece of functionality that can be published through one or more technologies. Over HTTP, each endpoint appears under the base path /actuator, so the metrics endpoint is /actuator/metrics. Over JMX, the Java management technology used by tools like JConsole, the same endpoints appear as MBeans.
Whether a request to /actuator/metrics works depends on two separate questions: is the endpoint exposed over HTTP, and is access to it allowed? A 404 is the typical answer to the first question.
2Why /actuator/metrics Returns 404
Over HTTP, Spring Boot exposes only the health endpoint by default. Every other endpoint exists in the application but is not mapped to a URL, so the server answers as if the path did not exist.
The discovery page at /actuator is a quick way to see what is exposed: it lists a link for each exposed endpoint, and here it lists only health. The reason for this default is safety. Endpoints such as env, configprops and heapdump can reveal secrets or memory contents, and an application that adds Actuator without thinking about it should not publish them.
3Exposing metrics Over HTTP
We choose which endpoints are exposed with management.endpoints.web.exposure.include. It takes a list of endpoint ids, and there is a matching exclude property that wins over include.
Notice that we list the endpoints we want rather than using *. A star exposes every endpoint, including ones added by future versions or libraries, which is convenient on a laptop but risky in production. JMX has its own pair of properties, management.endpoints.jmx.exposure.include and exclude, and JMX itself is off unless spring.jmx.enabled is set.
4Exposure Is Not the Same as Access
Exposure decides whether an endpoint is reachable over a technology, HTTP or JMX. Access decides what the endpoint itself allows once reached. Since Spring Boot 3.4, access is set per endpoint with management.endpoint.<id>.access, whose values are none, read-only and unrestricted, and the default for all endpoints with management.endpoints.access.default. These replace the older management.endpoint.<id>.enabled and management.endpoints.enabled-by-default properties, which are deprecated.
| Question | Property | If it says no |
|---|---|---|
| Is the endpoint exposed over HTTP? | management.endpoints.web.exposure.include | 404 Not Found |
| Is the operation allowed? | management.endpoint.<id>.access | Operation not available |
| Is this caller allowed? | Spring Security rules | 401 or 403 |
| Old style, before Boot 3.4 | management.endpoint.<id>.enabled | Deprecated |
Read-only access is a useful middle ground that did not exist with the old enabled flag: we can let operators read logger levels without letting them change them. There is also management.endpoints.access.max-permitted, which caps the access any endpoint can be given, useful in a platform starter. None of this replaces authentication. Access settings are about which operations exist; who may call them is decided by Spring Security.
5Putting the Answer Together
So when health answers and metrics gives 404, the endpoint is present but not exposed over HTTP, because only health is exposed by default. Adding metrics to management.endpoints.web.exposure.include fixes it. If the application also uses Spring Security, the next response might be a 401, which is a different question: the endpoint is now exposed, and the security rules decide who may call it. In production I would expose metrics or prometheus only to the internal monitoring network or behind authentication, never publicly.
- Listed at /actuator?YesExposed: check access and securityNoAdd its id to exposure.include
- Got 401 or 403?YesFix the security rules for that pathNoGo on
- Write operation refused?YesRaise access to unrestricted if intendedNoEndpoint works
3 steps in order. Play them, or step through them one at a time.
6Follow-up questions
Why does /actuator/health work without any configuration?
Because health is the one endpoint exposed over HTTP by default. Load balancers and orchestrators need it to check the application, and by default it shows only an overall status such as UP, without component details, so it reveals very little.
Does the metrics endpoint need a Prometheus dependency?
No. The metrics endpoint shows meters from Micrometer, which comes with Actuator. The separate prometheus endpoint, the one a Prometheus server scrapes, appears only when micrometer-registry-prometheus is on the classpath, and it also must be exposed.
What happens to my old enabled properties after upgrading to Boot 3.4?
They are deprecated in favour of the access properties and still work for now, with deprecation warnings. It is worth replacing them, because a future version may remove them; management.endpoint.<id>.enabled=false maps to access=none.
7Conclusion
In this answer, we saw that /actuator/metrics returns 404 because only the health endpoint is exposed over HTTP by default. management.endpoints.web.exposure.include exposes the endpoints we list, such as health,info,metrics. Exposure is separate from access control, which since Boot 3.4 uses management.endpoint.<id>.access and management.endpoints.access.default with none, read-only and unrestricted, replacing the old enabled properties, and both are separate from Spring Security's rules about who may call.
Open with
The metrics endpoint exists, but it is not exposed over HTTP. Since Boot 2, only the health endpoint is exposed over HTTP by default, because endpoints like env, configprops or heapdump can reveal secrets, so everything else answers 404 until we choose it.
Then, if they want more
The /actuator discovery page shows that, it only lists health. To expose metrics I set management.endpoints.web.exposure.include to health,info,metrics. I prefer listing the ids rather than using a star, which would expose everything, including endpoints added later. JMX has its own include and exclude properties. The second thing to understand is that exposure is not access.
Exposure says whether an endpoint is reachable over HTTP or JMX. Access says which of its operations are allowed. Since Boot 3.4 that is management.endpoint.<id>.access with none, read-only or unrestricted, plus management.endpoints.access.default for all endpoints, and these replace the old enabled and enabled-by-default properties.
For example, I can expose loggers with read-only access so people can read levels but not change them. And both are separate from security: if Spring Security is on, the next response might be a 401, and in production metrics should only be reachable by internal monitoring or with authentication.
About this answer
- Last updated
- 12 November 2026
- Versions it names
- Spring Boot 3.4
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Spring Boot reference, Actuator
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "You add spring-boot-starter-actuator and can reach /actuator/health but...": https://scrivio-interview-library.netlify.app/spring-boot/actuator/c7a04746c1/