Add core-di: constructor vs setter vs field injection and @Autowired candidate resolution 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:40 +00:00
parent b0c39a8d4c
commit 9825efa081
87 changed files with 1945 additions and 0 deletions
+42
View File
@@ -0,0 +1,42 @@
#!/usr/bin/env bash
# Starts the real Boot application with three different profiles and captures what a developer
# actually sees: the "APPLICATION FAILED TO START" report for a circular dependency, and the same
# application starting once spring.main.allow-circular-references is switched on.
set -euo pipefail
cd "$(dirname "$0")/.."
mkdir -p output
JAR=$(ls target/core-di-*.jar | head -1)
# Drops JAVA_TOOL_OPTIONS noise, machine-specific paths, timestamps and PIDs so reruns diff cleanly.
strip() {
grep -v -E '^Picked up JAVA_TOOL_OPTIONS' \
| sed -E 's#jar:nested:[^ ]*/target/#jar:nested:target/#; s#^[0-9T:.+-]+ (ERROR|WARN|INFO) [0-9]+ --- \[core-di\] \[[^]]*\] #\1 --- #' \
|| true
}
{
echo "# Boot start-up failure for a constructor cycle: --spring.profiles.active=ctor-cycle"
echo
java -jar "$JAR" --spring.profiles.active=ctor-cycle --spring.main.banner-mode=off --logging.level.root=ERROR 2>&1 | strip || true
} > output/19-boot-failure-analysis-ctor-cycle.txt
{
echo "# Boot start-up failure for a field-injection cycle: --spring.profiles.active=field-cycle"
echo
java -jar "$JAR" --spring.profiles.active=field-cycle --spring.main.banner-mode=off --logging.level.root=ERROR 2>&1 | strip || true
} > output/20-boot-failure-analysis-field-cycle.txt
{
echo "# Same field cycle with --spring.main.allow-circular-references=true"
echo
java -jar "$JAR" --spring.profiles.active=field-cycle --spring.main.allow-circular-references=true \
--spring.main.banner-mode=off --logging.level.root=WARN 2>&1 | strip
} > output/21-boot-allow-circular-references.txt
{
echo "# @Lazy on one constructor parameter: --spring.profiles.active=lazy-cycle"
echo
java -jar "$JAR" --spring.profiles.active=lazy-cycle --spring.main.banner-mode=off --logging.level.root=WARN 2>&1 | strip
} > output/22-boot-lazy-cycle.txt
cat output/19-*.txt output/20-*.txt output/21-*.txt output/22-*.txt