声明式事务7
远程调试
setenv.sh
追加:
export JAVA_OPTS="$JAVA_OPTS -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:8000"
IDEA → Run → Edit Configurations → Remote JVM Debug → Host: localhost, Port: 8000 → 启动断点即可。
10. 回滚演练再次验证
把库存调回 10:
jdbc:mysql://...
或 H2 Consolehttp://localhost:8080/library/h2-console
(若配了)用 curl 连续借 15 次:
for i in {1..15}; docurl -s "http://localhost:8080/library/book/borrow?bookId=1&userId=$i"
done
最终库存 ≥ 0,且总数 + 日志条数一致 → 事务生效。