Files
spring-boot-demo/graalvm-native-images/scripts/trace-reflection.sh
T
Claude 8cdfcd4d8d Add graalvm-native-images: Boot 4.1 + GraalVM CE for JDK 25, AOT processing,
the tracing agent, and a real reflection-collision trap

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01EQNA6DJ9VgCtW6zhCE8Xud
2026-09-20 11:03:09 +00:00

19 lines
789 B
Bash

#!/usr/bin/env bash
# Reproduces the tracing-agent fix for the /report reflection trap: run the plain jar under the
# GraalVM tracing agent, exercise both code paths, then rebuild the native image with the
# generated hints merged in under a namespace that does NOT collide with Spring's own AOT output.
set -euo pipefail
cd "$(dirname "$0")/.."
rm -rf agent-output && mkdir -p agent-output
"$GRAALVM_HOME/bin/java" -agentlib:native-image-agent=config-output-dir=agent-output \
-jar target/app.jar --server.port=8083 &
AGENT_PID=$!
sleep 10
curl -s "localhost:8083/report?format=plain"; echo
curl -s "localhost:8083/report?format=json"; echo
kill $AGENT_PID
echo "Generated hints for our own classes:"
grep -A4 "com.ankurm.graalvmdemo.report" agent-output/reachability-metadata.json