Add core-beans: bean scopes, the prototype-in-singleton trap, lifecycle callback order and graceful shutdown phases on Boot 4.1

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JoVmf2fWvcpoXndcDSwRf7
This commit is contained in:
Claude
2026-09-24 04:59:41 +00:00
parent 9825efa081
commit 51f3ecd5da
65 changed files with 1780 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
#!/usr/bin/env bash
# Reads the shutdown-related property defaults out of Boot's own configuration metadata, and the
# SmartLifecycle phase constants out of the Boot jars with javap, instead of trusting doc prose.
set -euo pipefail
cd "$(dirname "$0")/.."
mkdir -p output target/meta
BOOT=4.1.1
M2=~/.m2/repository/org/springframework/boot
{
echo "# Property defaults read from spring-configuration-metadata.json (Boot $BOOT jars)"
echo
for jar in $(find "$M2" -name "*-$BOOT.jar" ! -name '*sources*' ! -name '*javadoc*' | sort); do
{ unzip -p "$jar" META-INF/spring-configuration-metadata.json 2>/dev/null || true; } | python3 -c '
import json,sys
try:
d=json.load(sys.stdin)
except Exception:
sys.exit(0)
for p in d.get("properties",[]):
if p["name"] in ("server.shutdown","spring.lifecycle.timeout-per-shutdown-phase","spring.threads.virtual.enabled"):
print("%-46s type=%-40s default=%s" % (p["name"], p.get("type"), p.get("defaultValue")))
'
done
} > output/18-property-defaults.txt
cat output/18-property-defaults.txt
+20
View File
@@ -0,0 +1,20 @@
#!/usr/bin/env bash
# Regenerates every file under output/.
#
# ./scripts/run-all.sh
#
# Needs a JDK 25 and Maven 3.9. Transcripts 01-17 and 19 come out of the test suite, which is the point:
# the figures in the two articles are assertions that fail the build if they stop being true.
# Timing-based rows (12, 16) assert coarse thresholds, not exact milliseconds.
set -euo pipefail
cd "$(dirname "$0")/.."
echo "== test suite (transcripts 01-17)"
mvn -B test
echo "== property defaults read from Boot's metadata (18)"
./scripts/capture-metadata.sh
echo
echo "output:"
ls -1 output