spring tx:advice事务配置—— tx:advice中不允许出现属性 ‘transaction-manager‘

今天在配置java事务管理时出现了一些问题。

提示:只有这几个属性

经过查询资料发现是bean的配置少了一些。

可以在xml文件顶部添加:

复制代码
       xmlns:tx="http://www.springframework.org/schema/tx"

下面也提供一份bean文件配置的模板:

(可以直接将bean文件默认设置为如下模板)

复制代码
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:aop="http://www.springframework.org/schema/aop"
	xmlns:tx="http://www.springframework.org/schema/tx"
	xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.3.xsd
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
		http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.3.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd">
</beans>

模板参考:元素 'tx:advice' 中不允许出现属性 'transaction-manager'-CSDN博客

相关推荐
非优秀程序员3 小时前
第07章 孙德良的阳谋|《互联网产品恩仇录》
javascript·后端
非优秀程序员3 小时前
第06章 浙江帮的内战|《互联网产品恩仇录》
后端
非优秀程序员3 小时前
第08章 马云的反击|《互联网产品恩仇录》
后端
非优秀程序员4 小时前
题记|《互联网产品恩仇录》
后端·程序员·创业
非优秀程序员4 小时前
第04章 邮箱大战,163 与 QQ 的暗战|《互联网产品恩仇录》
java·vue.js·架构
知已难寻4 小时前
Docker 入门:容器技术与 Docker 基础
java·运维·服务器·docker·云原生·容器
文丑颜不良啊6 小时前
LeetCode2481~2500题目解析
java·leetcode
Flynn Liang7 小时前
同一需求三套写法:用 Spring AI、LangChain4j、AgentScope Java 各实现一个带工具调用的 RAG 助手(实战对比)
java·人工智能·大模型·架构设计·spring ai·langchain4j·agentscope
Gopher_HBo7 小时前
Go CPU 剖析的"地基":信号、CAS、写屏障、无锁环形缓冲
后端
panbook8 小时前
从0到1实现一个分布式时序数据库(二):写入成功之后,如何用 WAL 找回数据
后端