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博客

相关推荐
JosieBook3 分钟前
【数据库】时序预测能力的分级进化:TimechoAI如何让每一类用户都能精准预见未来
java·开发语言·数据库
一生了无挂1 小时前
Java处理JSON技巧教学(从基础到高阶实战全覆盖)
java·开发语言·json
李白的天不白1 小时前
使用 SmartAdmin 进行前后端开发
java·前端
swordbob1 小时前
Spring 单例 Bean 是线程安全的吗?
java·开发语言
2601_951643772 小时前
Python第一,Java跌出前三,C语言杀回来了
java·c语言·python·编程语言排行·技术趋势
张忠琳3 小时前
【Go 1.26.4】Golang Select 深度解析
开发语言·后端·golang
腾科IT教育3 小时前
Spring AI Alibaba 向量(VectorStore)
人工智能·spring·microsoft
IT_陈寒3 小时前
React中useEffect依赖项这个坑我居然踩了三天
前端·人工智能·后端
IT 行者4 小时前
GitHub Spec Kit 实战(五):/speckit.tasks 怎么拆——Spec Kit 五部曲收官
java·ai编程·claude
提笔了无痕4 小时前
如何用Go实现整套RAG流程
开发语言·后端·golang