Add boot42-upgrade module: Spring Boot 4.2.0 GA vs 4.1.3 upgrade checklist
Re-runs the RC1 checklist on GA and adds SSL-bundle options on the LDAP client, the migrator fail switch, OpenTelemetry convention spellings, migrated RestClient/RestTestClient, compiler removal warnings for RestTemplate, TestRestTemplate and Pulsar, and jar/BOM probes. Transcripts in output/. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b5G8Z7wYEQnr5w4DfG
This commit is contained in:
Executable
+33
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
# Compiles each file in src/broken/ with -Xlint:deprecation against the module classpath of the
|
||||
# given pom (default pom.xml = 4.2.0; pass pom-41.xml for the 4.1.3 baseline) and stores the
|
||||
# compiler's own messages in output/05-... and output/06-... (suffix -on-4.1.3 for the baseline).
|
||||
set -u
|
||||
cd "$(dirname "$0")/.."
|
||||
POM="${1:-pom.xml}"
|
||||
LABEL=$(grep -m1 '<boot.label>' "$POM" | sed -E 's/.*<boot.label>(.*)<\/boot.label>.*/\1/')
|
||||
SUFFIX=""; [[ "$LABEL" == 4.2* ]] || SUFFIX="-on-$LABEL"
|
||||
mvn -B -q -f "$POM" dependency:build-classpath -Dmdep.outputFile=target/cp.txt >/dev/null 2>&1
|
||||
# spring-boot-pulsar is not a dependency of the module (it would auto-configure a Pulsar client);
|
||||
# it is added to the compile classpath for UsesPulsarProperties only.
|
||||
PULSAR="$HOME/.m2/repository/org/springframework/boot/spring-boot-pulsar/$LABEL/spring-boot-pulsar-$LABEL.jar"
|
||||
[ -f "$PULSAR" ] || mvn -B -q dependency:get -Dartifact="org.springframework.boot:spring-boot-pulsar:$LABEL" >/dev/null 2>&1
|
||||
CP="$(cat target/cp.txt):$PULSAR"
|
||||
|
||||
compile_one() { # <source> <outfile-base> <title>
|
||||
local src="$1" base="$2" title="$3" out="output/$2$SUFFIX.txt"
|
||||
rm -rf target/broken && mkdir -p target/broken
|
||||
{
|
||||
echo "# $base (Spring Boot $LABEL, JDK $(javac -version 2>&1 | grep -v Picked | awk '{print $2}'))"
|
||||
echo "\$ javac -Xlint:deprecation -cp <module classpath> -d target/broken $src"
|
||||
javac -Xlint:deprecation -cp "$CP" -d target/broken "$src" 2>&1 | grep -v '^Picked up' | sed -e "s#^$(pwd)/##"
|
||||
echo "exit: ${PIPESTATUS[0]}"
|
||||
} > "$out"
|
||||
cat "$out"
|
||||
}
|
||||
|
||||
compile_one src/broken/UsesRestTemplate.java 05-resttemplate-compiler-warnings "RestTemplate"
|
||||
{ compile_one src/broken/UsesTestRestTemplate.java 06-testresttemplate-compiler-warnings "TestRestTemplate"; } >/dev/null
|
||||
{ compile_one src/broken/UsesPulsarProperties.java 07-pulsar-compiler-warnings "Pulsar"; } >/dev/null
|
||||
# The migrated form must compile with no [removal] warning at all.
|
||||
{ compile_one src/main/java/com/ankurm/boot42up/PingClient.java 14-migrated-client-compiler "PingClient"; } >/dev/null
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
# Re-runs MigratorTest on 4.2.0 with the two Actuator-related starters removed from the classpath and
|
||||
# stores what the migrator prints in output/20-migrator-without-actuator.txt. The migrator can only
|
||||
# report a key whose metadata is on the classpath, and the metadata for management.* keys ships in
|
||||
# the Actuator/Micrometer jars.
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
python3 - <<'PY'
|
||||
import re
|
||||
s = open("pom.xml").read()
|
||||
for art in ("spring-boot-starter-actuator", "spring-boot-starter-opentelemetry"):
|
||||
s = re.sub(r"\s*<dependency>\s*<groupId>org.springframework.boot</groupId>\s*<artifactId>%s</artifactId>\s*</dependency>" % art, "", s)
|
||||
open("pom-no-actuator.xml", "w").write(s)
|
||||
PY
|
||||
cp output/04-properties-migrator-report.txt target/04-with-actuator.txt
|
||||
# ConventionSpellingsTest and MigratedClientsTest need Actuator/Micrometer; only MigratorTest runs here
|
||||
mvn -B -q -f pom-no-actuator.xml test -Dtest=MigratorTest -Dsurefire.failIfNoSpecifiedTests=false >/dev/null
|
||||
sed 's/^# 04-properties-migrator-report/# 20-migrator-without-actuator/' output/04-properties-migrator-report.txt > output/20-migrator-without-actuator.txt
|
||||
cp target/04-with-actuator.txt output/04-properties-migrator-report.txt
|
||||
rm -f pom-no-actuator.xml
|
||||
cat output/20-migrator-without-actuator.txt
|
||||
Executable
+143
@@ -0,0 +1,143 @@
|
||||
#!/usr/bin/env bash
|
||||
# Reads facts straight out of the published Spring Boot 4.1.3 and 4.2.0 artifacts on Maven Central:
|
||||
# output/10-config-defaults.txt defaults from META-INF/spring-configuration-metadata.json
|
||||
# output/11-buildpack-defaults.txt default builder / run image constants (javap -constants)
|
||||
# output/12-bom-versions.txt spring-boot-dependencies BOM properties, 4.1.3 vs 4.2.0
|
||||
# Needs JDK 25 (javap), python3, curl, unzip.
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
OLD=4.1.3; NEW=4.2.0
|
||||
W=target/probe; mkdir -p "$W" output
|
||||
M=https://repo1.maven.org/maven2/org/springframework/boot
|
||||
|
||||
fetch() { # <artifact> <version> <ext>
|
||||
local f="$W/$1-$2.$3"
|
||||
[ -s "$f" ] || curl -sfL -o "$f" "$M/$1/$2/$1-$2.$3"
|
||||
echo "$f"
|
||||
}
|
||||
unpack() { # <artifact> <version> -> dir
|
||||
local d="$W/x-$2/$1"
|
||||
[ -d "$d" ] || { mkdir -p "$d"; unzip -q -o "$(fetch "$1" "$2" jar)" -d "$d"; }
|
||||
echo "$d"
|
||||
}
|
||||
|
||||
for v in "$OLD" "$NEW"; do for a in spring-boot-tomcat spring-boot-micrometer-observation spring-boot-opentelemetry spring-boot-buildpack-platform; do unpack $a $v >/dev/null; done; done
|
||||
for a in spring-boot-amqp; do unpack $a $OLD >/dev/null; done
|
||||
for a in spring-boot-rabbitmq spring-boot-amqp-rabbitmq; do unpack $a $NEW >/dev/null; done
|
||||
|
||||
# ---- 10: configuration metadata defaults -------------------------------------------------------
|
||||
python3 - "$W" "$OLD" "$NEW" > output/10-config-defaults.txt <<'PY'
|
||||
import json, sys, subprocess, os
|
||||
W, OLD, NEW = sys.argv[1:4]
|
||||
# (artifact in 4.1.3, artifact in 4.2.0, key in 4.1.3, key in 4.2.0)
|
||||
ROWS = [
|
||||
("spring-boot-tomcat", "spring-boot-tomcat", "server.tomcat.use-relative-redirects", "server.tomcat.servlet.use-relative-redirects"),
|
||||
("spring-boot-tomcat", "spring-boot-tomcat", "server.tomcat.redirect-context-root", "server.tomcat.servlet.redirect-context-root"),
|
||||
("spring-boot-amqp", "spring-boot-rabbitmq", "spring.rabbitmq.username", "spring.rabbitmq.username"),
|
||||
("spring-boot-amqp", "spring-boot-rabbitmq", "spring.rabbitmq.password", "spring.rabbitmq.password"),
|
||||
("spring-boot-amqp", "spring-boot-amqp-rabbitmq", "spring.rabbitmq.username", "spring.amqp.rabbitmq.username"),
|
||||
("spring-boot-amqp", "spring-boot-amqp-rabbitmq", "spring.rabbitmq.password", "spring.amqp.rabbitmq.password"),
|
||||
("spring-boot-amqp", "spring-boot-amqp-rabbitmq", "spring.rabbitmq.template.exchange", "spring.amqp.rabbitmq.template.exchange"),
|
||||
("spring-boot-amqp", "spring-boot-amqp-rabbitmq", "spring.rabbitmq.template.routing-key", "spring.amqp.rabbitmq.template.routing-key"),
|
||||
("spring-boot-micrometer-observation", "spring-boot-micrometer-observation", "management.observations.conventions", "management.observations.conventions"),
|
||||
("spring-boot-opentelemetry", "spring-boot-opentelemetry", "management.opentelemetry.otlp.endpoint", "management.opentelemetry.otlp.endpoint"),
|
||||
]
|
||||
def load(art, ver):
|
||||
d = os.path.join(W, f"x-{ver}", art, "META-INF", "spring-configuration-metadata.json")
|
||||
if not os.path.exists(d):
|
||||
return {}
|
||||
return {p["name"]: p for p in json.load(open(d))["properties"]}
|
||||
print(f"# 10-config-defaults (spring-configuration-metadata.json from the {OLD} and {NEW} jars)")
|
||||
print(f"{'key':<52} {OLD:<16} {NEW}")
|
||||
for a_old, a_new, k_old, k_new in ROWS:
|
||||
o = load(a_old, OLD).get(k_old); n = load(a_new, NEW).get(k_new)
|
||||
def show(p, key):
|
||||
if p is None: return "(absent)"
|
||||
d = p.get("defaultValue", "(none)")
|
||||
d = repr(d) if d != "(none)" else d
|
||||
dep = p.get("deprecation")
|
||||
return d + (" [deprecated]" if dep else "")
|
||||
label = k_old if k_old == k_new else f"{k_old} -> {k_new}"
|
||||
print(f"{label}")
|
||||
print(f"{'':<4}{OLD}: {show(o, k_old):<24} {NEW}: {show(n, k_new)}")
|
||||
PY
|
||||
|
||||
# ---- 11: buildpack defaults --------------------------------------------------------------------
|
||||
{
|
||||
echo "# 11-buildpack-defaults (javap -constants on BuildRequest in spring-boot-buildpack-platform)"
|
||||
for v in "$OLD" "$NEW"; do
|
||||
d=$(unpack spring-boot-buildpack-platform "$v")
|
||||
echo "[$v]"
|
||||
javap -constants -p -cp "$d" org.springframework.boot.buildpack.platform.build.BuildRequest 2>&1 \
|
||||
| grep -E 'static final java.lang.String DEFAULT_' | sed -E 's/^ +static final java.lang.String //'
|
||||
done
|
||||
} > output/11-buildpack-defaults.txt
|
||||
|
||||
# ---- 12: BOM versions --------------------------------------------------------------------------
|
||||
python3 - "$W" "$OLD" "$NEW" > output/12-bom-versions.txt <<'PY'
|
||||
import re, sys, subprocess, os
|
||||
W, OLD, NEW = sys.argv[1:4]
|
||||
def props(v):
|
||||
f = os.path.join(W, f"spring-boot-dependencies-{v}.pom")
|
||||
txt = open(f).read()
|
||||
block = re.search(r"<properties>(.*?)</properties>", txt, re.S).group(1)
|
||||
return dict(re.findall(r"<([A-Za-z0-9.\-]+)>([^<]+)</\1>", block))
|
||||
for v in (OLD, NEW):
|
||||
subprocess.run(["curl", "-sfL", "-o", os.path.join(W, f"spring-boot-dependencies-{v}.pom"),
|
||||
f"https://repo1.maven.org/maven2/org/springframework/boot/spring-boot-dependencies/{v}/spring-boot-dependencies-{v}.pom"], check=True)
|
||||
o, n = props(OLD), props(NEW)
|
||||
WANT = ["spring-framework.version","spring-security.version","spring-data-bom.version","spring-batch.version",
|
||||
"spring-kafka.version","spring-amqp.version","spring-integration.version","spring-graphql.version",
|
||||
"spring-session.version","spring-ldap.version","hibernate.version","jackson-bom.version","jackson-2-bom.version",
|
||||
"micrometer.version","micrometer-tracing.version","opentelemetry.version","netty.version","tomcat.version",
|
||||
"jetty.version","flyway.version","junit-jupiter.version","mockito.version","assertj.version","lettuce.version",
|
||||
"thymeleaf.version","logback.version","log4j2.version","snakeyaml.version","kotlin.version","h2.version",
|
||||
"testcontainers.version","reactor-bom.version","janino.version"]
|
||||
print(f"# 12-bom-versions (spring-boot-dependencies POM properties)")
|
||||
print(f"{'property':<28}{OLD:<18}{NEW}")
|
||||
for k in WANT:
|
||||
print(f"{k:<28}{o.get(k,'(not managed)'):<18}{n.get(k,'(not managed)')}")
|
||||
changed = [k for k in n if k in o and n[k] != o[k]]
|
||||
added = [k for k in n if k not in o]; removed = [k for k in o if k not in n]
|
||||
print(f"properties: {len(o)} in {OLD}, {len(n)} in {NEW}; changed {len(changed)}, added {len(added)}, removed {len(removed)}")
|
||||
print("removed: " + ", ".join(sorted(removed)))
|
||||
print("added: " + ", ".join(sorted(added)))
|
||||
PY
|
||||
|
||||
|
||||
# ---- 15: what the AMQP starter names mean ------------------------------------------------------
|
||||
python3 - "$W" "$OLD" "$NEW" > output/15-amqp-starters.txt <<'PY'
|
||||
import re, sys, urllib.request
|
||||
W, OLD, NEW = sys.argv[1:4]
|
||||
def pom(art, ver):
|
||||
url = f"https://repo1.maven.org/maven2/org/springframework/boot/{art}/{ver}/{art}-{ver}.pom"
|
||||
try:
|
||||
return urllib.request.urlopen(url).read().decode()
|
||||
except Exception:
|
||||
return None
|
||||
print("# 15-amqp-starters (published POMs: description and boot-level dependency)")
|
||||
for ver in (OLD, NEW):
|
||||
print(f"[{ver}]")
|
||||
for art in ("spring-boot-starter-amqp", "spring-boot-starter-rabbitmq", "spring-boot-starter-amqp-rabbitmq"):
|
||||
t = pom(art, ver)
|
||||
if t is None:
|
||||
print(f" {art:<36} (not published in {ver})")
|
||||
continue
|
||||
desc = re.search(r"<description>(.*?)</description>", t, re.S).group(1).strip()
|
||||
deps = [d for d in re.findall(r"<artifactId>(spring-boot-[a-z0-9-]+)</artifactId>", t)[1:] if d != "spring-boot-starter"]
|
||||
print(f" {art:<36} \"{desc}\" -> {', '.join(deps)}")
|
||||
PY
|
||||
|
||||
# ---- 16: properties-migrator failure switch ----------------------------------------------------
|
||||
{
|
||||
echo "# 16-migrator-fail-switch (spring-boot-properties-migrator $NEW)"
|
||||
d=$(unpack spring-boot-properties-migrator "$NEW")
|
||||
python3 - "$d" <<'PY'
|
||||
import json, sys
|
||||
d = json.load(open(sys.argv[1] + "/META-INF/spring-configuration-metadata.json"))
|
||||
for p in d["properties"]:
|
||||
print(f"{p['name']} default={p.get('defaultValue')}")
|
||||
PY
|
||||
javap -constants -p -cp "$d" 'org.springframework.boot.context.properties.migrator.PropertiesMigrationListener$Fail' 2>&1 \
|
||||
| grep -E 'public static final' | sed -E 's/.*Fail //;s/;//' | sed 's/^/ value: /'
|
||||
} > output/16-migrator-fail-switch.txt
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
# Regenerates every file in output/ on Spring Boot 4.2.0 (GA) and on the 4.1.3 baseline.
|
||||
# Needs JDK 25 and Maven 3.9 on PATH, plus network access to Maven Central.
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
mvn -B -q test
|
||||
mvn -B -q -f pom-41.xml test
|
||||
scripts/compile-broken.sh pom.xml >/dev/null
|
||||
scripts/compile-broken.sh pom-41.xml >/dev/null
|
||||
scripts/probe-jars.sh
|
||||
scripts/migrator-without-actuator.sh >/dev/null
|
||||
echo "done: $(ls output | wc -l) files in output/"
|
||||
Reference in New Issue
Block a user