<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>声明式事务 - 标签 | 飞污熊小站</title><link>https://xiongneng.me/tags/%E5%A3%B0%E6%98%8E%E5%BC%8F%E4%BA%8B%E5%8A%A1/</link><description>飞污熊小站</description><generator>Hugo 0.166.0 &amp; FixIt v0.4.6-20260512073637-464c4659</generator><language>zh-CN</language><managingEditor>yidao620@163.com (XiongNeng)</managingEditor><webMaster>yidao620@163.com (XiongNeng)</webMaster><copyright>XiongNeng</copyright><lastBuildDate>Fri, 25 Sep 2026 02:16:47 +0000</lastBuildDate><atom:link href="https://xiongneng.me/tags/%E5%A3%B0%E6%98%8E%E5%BC%8F%E4%BA%8B%E5%8A%A1/index.xml" rel="self" type="application/rss+xml"/><item><title>SpringBoot4系列06 - 声明式事务</title><link>https://xiongneng.me/posts/java/springboot/sb4-transaction/</link><pubDate>Tue, 22 Sep 2026 22:00:00 +0800</pubDate><author>yidao620@163.com (XiongNeng)</author><guid>https://xiongneng.me/posts/java/springboot/sb4-transaction/</guid><category domain="https://xiongneng.me/categories/java/">Java</category><description>&lt;p&gt;第五篇收尾时留了个话头：一个事务管理器身上，还有哪些东西是配置不出来的。这一篇回答它。&lt;/p&gt;&#10;&lt;p&gt;&lt;code&gt;@Transactional&lt;/code&gt; 是 Spring 里最像「不用学」的注解：加一行，方法就进事务了。但它有个脾气：&lt;strong&gt;用对的时候什么都不用知道，用错了它不告诉你。&lt;/strong&gt;&lt;/p&gt;&#10;&lt;p&gt;最典型的翻车现场：接口返回 422，异常栈打在日志里，调用方按失败处理。然后查库，钱已经扣了。没有报错，没有 WARN，日志上还写着「Initiating transaction commit」，事务管理器认为一切正常，按照默认规则该提交。&lt;/p&gt;</description></item></channel></rss>