Quick revision
The short answer
I would first build an inventory of every custom endpoint and its operations, then set a rule that every write operation needs authentication, an operator role and an audit record of who did what, enforced by the platform rather than by each team. Common needs such as feature toggles and cache clearing should move to shared platform tools instead of per-service endpoints. New endpoints go through published guidelines and a short review, and endpoints nobody uses are switched off with Actuator's access properties.
What to remember
In this answer, we governed custom actuator endpoints in four steps. We took an inventory of every endpoint and its operations, required authentication, an operator role and an audit record for every write through a platform filter, moved common operations such as feature toggles and cache resets to shared tools, and kept the rest under published guidelines, a light review and Actuator's access properties, with unused endpoints switched off.
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.
I would first build an inventory of every custom endpoint and its operations, then set a rule that every write operation needs authentication, an operator role and an audit record of who did what, enforced by the platform rather than by each team. Common needs such as feature toggles and cache clearing should move to shared platform tools instead of per-service endpoints. New endpoints go through published guidelines and a short review, and endpoints nobody uses are switched off with Actuator's access properties.
Why this question is asked
Custom actuator endpoints are easy to write, which is both their strength and the problem in this scenario. Each team solved a real operational need, but together they created dozens of unaudited buttons that change production behaviour, and during an incident nobody can tell who cleared a cache or flipped a flag. Interviewers ask this scenario to see whether we can bring order to a sprawl without blocking teams. In this answer, we will look at the situation and its risks, take an inventory, add authentication and auditing that every service inherits, consolidate common operations into platform tools, and set up the guidelines and switches that keep it under control.
1The Situation and Why It Is Risky
Imagine 60 services, of which 25 have custom endpoints: some clear caches, some toggle features, one replays failed messages, one resets a rate limiter. They were added over three years by different teams. Some sit behind the actuator security chain; some do not. None record who called them. Last month a cache was cleared at peak time and the database fell over; it took two days to find out that a support engineer had called the endpoint from a runbook.
Three risks follow from this. Security: a write operation reachable without strong authentication is a way to change production from outside. Reliability: state changes with no record make incidents hard to diagnose. Consistency: 25 different designs for the same few operations mean each runbook is different and each endpoint has its own bugs.
2Take an Inventory
We cannot govern what we cannot see. Actuator helps here: GET /actuator on each service lists the exposed endpoints with their links, and the mappings endpoint shows every operation and HTTP method. A code search for @Endpoint, @WebEndpoint and @RestControllerEndpoint across repositories finds the ones not exposed in every environment. I would put the results in one table: service, endpoint, operations, whether it writes, who uses it and how often.
| Service | Endpoint | Writes | Protected | Calls per month |
|---|---|---|---|---|
| catalog | cachereset | yes | no | 40 |
| checkout | featureflags | yes | OPS role | 120 |
| orders | replay | yes | OPS role | 6 |
| search | indexstats | no | OPS role | 2 |
| pricing | ratelimit | yes | no | 0 |
Notice how the table already sets priorities. Unprotected writes are fixed first, unused endpoints are candidates for removal, and repeated operations, such as several kinds of cache reset, are candidates for a shared tool.
3Authentication, Roles and Audit for Every Write
The rule is simple to state: every write or delete operation requires an authenticated caller with an operator role, and produces an audit record with who, what, when, and the arguments. The important design choice is to enforce it in the platform starter, so teams do not each have to remember it. The starter provides the actuator SecurityFilterChain, which requires the operator role for any POST or DELETE under the actuator base path, and a small servlet filter in that chain that writes an audit event after each such request.
The audit log goes to the central log platform like any other structured log, where it can be searched and alerted on. Notice that the filter records the outcome too, so a refused attempt is as visible as a successful one. Teams that need the request body in the record can log the arguments inside their operation, but the who, what and when are guaranteed by the platform.
4Replace Common Operations With Platform Tools
Many custom endpoints exist because there was no shared tool. Feature toggles are the clearest example: a per-service endpoint that flips an in-memory flag only changes one pod, is lost on restart, and has no history. A feature flag service, bought or built, gives consistent state across pods, gradual rollouts, a history of every change and its own access control. Cache clearing is similar: a small admin UI or an operations tool that calls a standard, audited endpoint in each service with a confirmation step is safer than 10 different curl commands in runbooks.
The reasoning is about where to put effort. Securing and auditing 25 bespoke endpoints is work that never ends. Moving the three or four most common operations to shared tools removes most of them, and the tools can add what single endpoints cannot: approvals for risky actions, rate limits such as no more than one cache clear per service per ten minutes, and a view of who did what across the whole fleet.
- Is it used at all?YesKeep reviewing itNoSwitch it off with access=none
- Does a platform tool cover it?YesMigrate callers, then remove itNoKeep it as a custom endpoint
- Does it change state?YesRequire operator role and auditNoRead-only, normal protection
- Document it in the service runbook and catalog
4 steps in order. Play them, or step through them one at a time.
5Guidelines, Review and Access Switches
For the endpoints that remain, and for new ones, I would publish short guidelines: prefer read operations, keep write operations idempotent where possible, validate inputs, use @WebEndpoint unless JMX is really needed, and never expose an endpoint that returns secrets or personal data. Adding a new write operation needs a short review by the platform or security team, which is a checklist, not a committee.
Finally, Actuator's access properties, available since Spring Boot 3.4, let us switch endpoints off or make them read-only without code changes. The platform can cap the whole fleet and teams can turn on only what they need (check your version for the exact property names).
6Follow-up questions
Why audit in a filter instead of in each endpoint?
Because a filter in the platform's security chain covers every endpoint, including the ones a team adds next year without thinking about auditing. Logging inside the endpoint can add detail, but the guarantee must not depend on each author remembering it.
Should custom endpoints be banned altogether?
No. Some operations are specific to one service, such as replaying messages from a particular dead letter topic, and an actuator endpoint is a good home for them because it reuses the same security, exposure and tooling. The goal is that every endpoint is known, protected, audited and justified.
How do you handle the support engineer who cleared the cache at peak time?
That is a process gap, not a person to blame. The fix is a tool with a confirmation step and a rate limit, an audit record that makes the action visible in the incident channel, and a runbook that says when the action is safe. Blaming the person would only make people hide what they did.
7Conclusion
In this answer, we governed custom actuator endpoints in four steps. We took an inventory of every endpoint and its operations, required authentication, an operator role and an audit record for every write through a platform filter, moved common operations such as feature toggles and cache resets to shared tools, and kept the rest under published guidelines, a light review and Actuator's access properties, with unused endpoints switched off.
Open with
I would start with an inventory: for every service, which custom endpoints exist, which operations they have, whether they write, whether they are protected, and how often they are called.
Then, if they want more
GET /actuator, the mappings endpoint and a code search for @Endpoint give that quickly. Then I would set one rule for every write or delete operation: an authenticated caller with an operator role, and an audit record of who did what, when and with what result.
I would enforce that in the platform starter, with the actuator security chain requiring the role for any POST or DELETE and a filter writing a structured audit log, so teams get it without remembering. Next, I would look at what the endpoints are for.
Feature toggles and cache clearing appear again and again, and per-service endpoints for them are inconsistent, per pod and unaudited, so I would move those to a feature flag service and an admin tool with confirmation and rate limits.
For what remains, I would publish short guidelines and a light review for new write operations, and use Actuator's access properties, with a read-only default and unused endpoints set to none, so nothing can change state unless it was reviewed.
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 "Several teams wrote custom actuator endpoints that change state, such as clearing caches...": https://scrivio-interview-library.netlify.app/spring-boot/actuator/84e3f2bea1/