#!/usr/bin/env bash # The broken-aspect gallery: six aspects that do not fire, and why. set -euo pipefail set +m cd "$(dirname "$0")/.." source scripts/env.sh { echo "== aspects that do not fire ==" echo start_app > /dev/null curl -s "http://127.0.0.1:${APP_PORT}/aop/broken" | python3 -m json.tool echo echo "Reading it:" echo echo " 1 @Aspect without @Component - the class is never instantiated, so the pointcut" echo " is never registered. No warning is produced." echo " 2 pointcut typo - 'com.ankurm.aop.services' (plural) parses fine and" echo " matches nothing. An empty match set is not an error." echo " 3 private method - cannot be overridden, so cannot be intercepted." echo " 4 final method - CGLIB subclasses; a final method is inherited, not" echo " overridden. Note beanIsProxied is still true." echo " 5 self-invocation - innerAdvisedWhenCalledFromOuter is false and" echo " innerAdvisedWhenCalledDirectly is true. Same method," echo " same advice: only the call path differs." echo " 6 created with new - no container, no proxy, no advice." stop_app } > docs/output/03-broken-gallery.txt 2>&1 cat docs/output/03-broken-gallery.txt