#!/usr/bin/env bash # Prints what the two Boot 4.2.0 starters really contain, read straight from their jars # (spring-configuration-metadata.json and the auto-configuration imports). Run after one mvn build # so the jars are in ~/.m2. set -eu cd "$(dirname "$0")/.." OUT=output/10-starter-comparison.txt M2="${HOME}/.m2/repository" BOOT=$(ls "$M2/org/springframework/boot/spring-boot-amqp" | sort -V | tail -1) fetch() { # fetch -> jar path (downloads via maven if missing) local jar="$M2/$1/$2/$3/$2-$3.jar" [ -f "$jar" ] || mvn -B -q dependency:get -Dartifact="$(echo "$1" | tr / .):$2:$3" >/dev/null echo "$jar" } props() { # props unzip -p "$1" META-INF/spring-configuration-metadata.json | python3 -c " import json,sys d=json.load(sys.stdin) for p in d['properties']: if p['name'].startswith('$2'): print(' %-48s default=%s' % (p['name'], p.get('defaultValue')))" } { echo "Spring Boot $BOOT" for s in amqp amqp-rabbitmq rabbitmq; do echo echo "== spring-boot-starter-$s: description and dependencies" pom="$M2/org/springframework/boot/spring-boot-starter-$s/$BOOT/spring-boot-starter-$s-$BOOT.pom" [ -f "$pom" ] || mvn -B -q dependency:get -Dartifact="org.springframework.boot:spring-boot-starter-$s:$BOOT:pom" >/dev/null grep -E '|spring-boot-(amqp|amqp-rabbitmq|rabbitmq)<' "$pom" | sed 's/^ *//' done echo echo "== spring-boot-amqp auto-configuration classes" unzip -p "$(fetch org/springframework/boot spring-boot-amqp "$BOOT")" META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports | sed 's/^/ /'; echo echo "== spring-boot-amqp properties (spring.amqp.*)" props "$(fetch org/springframework/boot spring-boot-amqp "$BOOT")" spring.amqp. echo echo "== spring-boot-amqp-rabbitmq auto-configuration classes" unzip -p "$(fetch org/springframework/boot spring-boot-amqp-rabbitmq "$BOOT")" META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports | sed 's/^/ /'; echo echo "== spring-boot-amqp-rabbitmq properties (spring.amqp.rabbitmq.*)" props "$(fetch org/springframework/boot spring-boot-amqp-rabbitmq "$BOOT")" spring.amqp.rabbitmq. | grep -E 'rabbitmq\.(host|port|username|password|address) ' echo echo "== spring-boot-rabbitmq auto-configuration classes" unzip -p "$(fetch org/springframework/boot spring-boot-rabbitmq "$BOOT")" META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports | sed 's/^/ /'; echo echo "== spring-boot-rabbitmq properties (selected spring.rabbitmq.*)" props "$(fetch org/springframework/boot spring-boot-rabbitmq "$BOOT")" spring.rabbitmq. | grep -E 'rabbitmq\.(host|port|username|password|virtual-host) ' echo echo "== which Boot module wires RabbitMQ's AMQP 1.0 client (RabbitAmqpTemplate)?" for j in spring-boot-amqp spring-boot-amqp-rabbitmq spring-boot-rabbitmq; do n=$(unzip -p "$(fetch org/springframework/boot $j "$BOOT")" 'org/springframework/boot/*/autoconfigure/*AutoConfiguration*.class' 2>/dev/null | strings | grep -c 'RabbitAmqpTemplate' || true) echo " $j: auto-configuration classes mentioning RabbitAmqpTemplate: $([ "$n" -gt 0 ] && echo yes || echo no)" done } > "$OUT" cat "$OUT"