Spring Boot 4 Actuator in production: endpoints, security, custom health indicators

Companion repository for the ankurm.com article. Every transcript in docs/output/
was produced by running this project; scripts/run-all.sh regenerates all of them.

Verified against Spring Boot 4.1.1 / Framework 7.0.9 / Security 7.1.1 /
Micrometer 1.17.1 / kafka-clients 4.2.1 on Temurin JDK 25.0.4.1+1.
This commit is contained in:
2026-09-04 10:40:04 +05:30
commit 4b6cefa60a
64 changed files with 3195 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
#!/usr/bin/env bash
# What Actuator exposes when you add the starter and configure nothing.
set -uo pipefail
cd "$(dirname "$0")/.."
OUT=docs/output/01-default-exposure.txt
{
echo "### Spring Boot Actuator, starter added, ZERO management.* configuration"
echo
echo "\$ curl -s -u ops:ops-password http://localhost:8080/actuator"
curl -s -u ops:ops-password http://localhost:8080/actuator | python3 -m json.tool
echo
echo "\$ curl -s -o /dev/null -w '%{http_code}' -u ops:ops-password http://localhost:8080/actuator/env"
curl -s -o /dev/null -w '%{http_code}\n' -u ops:ops-password http://localhost:8080/actuator/env
echo " 404 = discovered but NOT exposed over HTTP. Exposure and existence are different things."
echo
echo "\$ curl -s -u ops:ops-password http://localhost:8080/actuator/health"
curl -s -u ops:ops-password http://localhost:8080/actuator/health | python3 -m json.tool
echo
echo " Only 'health' is web-exposed by default. show-details defaults to 'never', so even an"
echo " authenticated caller sees a bare status until you say otherwise."
} > "$OUT" 2>&1
echo "wrote $OUT"