Files
spring-boot-demo/resilience/scripts/run.sh
T
asmhatreandClaude Opus 5 7e1676c763 Add resilience: Spring Framework 7 @Retryable and @ConcurrencyLimit
Companion code for "Spring Framework 7's Built-in Resilience: @Retryable,
@ConcurrencyLimit, and What's Left for Resilience4j". Every retry counted
by recording real invocations: defaults, backoff and jitter, timeout,
reactive and CompletableFuture returns, the concurrency limit's BLOCK and
REJECT policies, retries around transactions, composition with
Resilience4j 2.4.0, and the annotation API across 7.0.0-7.0.9.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01C3TETMrqVUWeFkNtz3Jbo3
2026-09-11 17:12:25 +00:00

21 lines
965 B
Bash

#!/usr/bin/env bash
# Start the application (optional comma-separated profiles) and wait until it
# answers. Any instance started by a previous run is stopped first, by PID file - never by
# pattern-matching the process list, which can match (and kill) the calling shell.
# ./scripts/run.sh
# EXTRA_ARGS=--demo.resilience.enabled=false ./scripts/run.sh
set -euo pipefail
source "$(dirname "$0")/env.sh"
"$MODULE_DIR/scripts/stop.sh"
PROFILES="${1:-}"
[ -f "$JAR" ] || (cd "$MODULE_DIR" && mvn -q -DskipTests package)
nohup java -jar "$JAR" --server.port="$PORT" ${PROFILES:+--spring.profiles.active=$PROFILES} ${EXTRA_ARGS:-} \
> "$LOG" 2>&1 < /dev/null &
echo $! > "$PIDFILE"
for _ in $(seq 1 60); do
if curl -s -o /dev/null "$BASE/actuator/health"; then exit 0; fi
if ! kill -0 "$(cat "$PIDFILE")" 2>/dev/null; then echo "application exited - see $LOG" >&2; exit 1; fi
sleep 0.5
done
echo "application did not start within 30s - see $LOG" >&2; exit 1