Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01B38FGKKam5SCGgwgduVAh3
72 lines
4.1 KiB
Bash
Executable File
72 lines
4.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Writes docs/output/16-serializers-javap.txt: which serializer classes ship in Spring Data Redis,
|
|
# which are deprecated, what the Jackson 3 ones accept, and which beans Boot 4.1 registers.
|
|
#
|
|
# Reading bytecode is how the article's claims about class names were checked. The reference
|
|
# documentation still shows Jackson 2 class names in places.
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")/.."
|
|
OUT=docs/output/16-serializers-javap.txt
|
|
|
|
CP_FILE=$(mktemp)
|
|
trap 'rm -f "$CP_FILE"' EXIT
|
|
mvn -B -q dependency:build-classpath -Dmdep.outputFile="$CP_FILE" >/dev/null
|
|
CP=$(cat "$CP_FILE")
|
|
jar_of() { tr ':' '\n' < "$CP_FILE" | grep "/$1-[0-9]" | head -1; }
|
|
SDR=$(jar_of spring-data-redis)
|
|
BOOT=$(jar_of spring-boot-data-redis)
|
|
S=org.springframework.data.redis.serializer
|
|
|
|
run() { # run <display-command> <shell-command>
|
|
echo "\$ $1"
|
|
bash -c "$2" || true
|
|
}
|
|
|
|
{
|
|
echo "# Serializer classes in $(basename "$SDR"), read from the jar"
|
|
echo
|
|
|
|
echo "--- What ships in org/springframework/data/redis/serializer ---"
|
|
run "unzip -l spring-data-redis-*.jar | grep serializer/ (top-level classes, names only)" \
|
|
"unzip -l '$SDR' | awk '{print \$4}' | grep 'redis/serializer/[A-Za-z0-9]*\.class' | sed 's|.*/||; s|\.class||' | grep -E 'Serializer\$' | sort"
|
|
echo
|
|
|
|
echo "--- Which of them are deprecated ---"
|
|
for c in GenericJackson2JsonRedisSerializer Jackson2JsonRedisSerializer GenericJacksonJsonRedisSerializer JacksonJsonRedisSerializer; do
|
|
run "javap -v -cp spring-data-redis-*.jar $S.$c | grep -E 'Deprecated|since'" \
|
|
"javap -v -cp '$SDR' $S.$c | grep -E 'Deprecated|since'"
|
|
echo "(end of output for $c)"
|
|
done
|
|
echo
|
|
|
|
echo "--- Jackson 3: what the constructors and factories accept ---"
|
|
run "javap -public -cp <classpath> $S.JacksonJsonRedisSerializer | grep 'JacksonJsonRedisSerializer('" \
|
|
"javap -public -cp '$CP' $S.JacksonJsonRedisSerializer | grep 'JacksonJsonRedisSerializer('"
|
|
run "javap -public -cp <classpath> $S.GenericJacksonJsonRedisSerializer | grep -E 'GenericJacksonJsonRedisSerializer\(|create|builder'" \
|
|
"javap -public -cp '$CP' $S.GenericJacksonJsonRedisSerializer | grep -E 'GenericJacksonJsonRedisSerializer\(|create|builder'"
|
|
echo
|
|
|
|
echo "--- Jackson 3: how the generic serializer's builder turns typing on ---"
|
|
run "javap -public -cp <classpath> '$S.GenericJacksonJsonRedisSerializer\$GenericJacksonJsonRedisSerializerBuilder' | grep -E 'Typing|typeValidator|typePropertyName'" \
|
|
"javap -public -cp '$CP' '$S.GenericJacksonJsonRedisSerializer\$GenericJacksonJsonRedisSerializerBuilder' | grep -E 'Typing|typeValidator|typePropertyName'"
|
|
echo
|
|
|
|
echo "--- What Boot 4.1 registers ---"
|
|
run "javap -p -cp spring-boot-data-redis-*.jar org.springframework.boot.data.redis.autoconfigure.DataRedisAutoConfiguration | grep -E 'redisTemplate|stringRedisTemplate'" \
|
|
"javap -p -cp '$BOOT' org.springframework.boot.data.redis.autoconfigure.DataRedisAutoConfiguration | grep -E 'redisTemplate|stringRedisTemplate'"
|
|
run "javap -p -cp spring-boot-data-redis-*.jar org.springframework.boot.data.redis.autoconfigure.DataRedisAnnotationDrivenConfiguration | grep 'redisMessageListenerContainer'" \
|
|
"javap -p -cp '$BOOT' org.springframework.boot.data.redis.autoconfigure.DataRedisAnnotationDrivenConfiguration | grep 'redisMessageListenerContainer'"
|
|
echo
|
|
|
|
echo "--- Defaults of @EnableRedisRepositories that matter for expiry ---"
|
|
run "javap -v -cp spring-data-redis-*.jar org.springframework.data.redis.repository.configuration.EnableRedisRepositories | grep -A6 -E '(enableKeyspaceEvents|keyspaceNotificationsConfigParameter)\\(\\);' | grep -E '\\(\\);|\"Ex\"|\\.OFF'" \
|
|
"javap -v -cp '$SDR' org.springframework.data.redis.repository.configuration.EnableRedisRepositories | grep -A6 -E '(enableKeyspaceEvents|keyspaceNotificationsConfigParameter)\\(\\);' | grep -E '\\(\\);|\"Ex\"|\\.OFF'"
|
|
echo
|
|
|
|
echo "--- The @RedisListener annotation ---"
|
|
run "javap -public -cp spring-data-redis-*.jar org.springframework.data.redis.annotation.RedisListener" \
|
|
"javap -public -cp '$SDR' org.springframework.data.redis.annotation.RedisListener"
|
|
} > "$OUT"
|
|
|
|
cat "$OUT"
|