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

相关推荐
Seven972 分钟前
虚拟线程深度解析:轻量并发编程的未来趋势
java
BingoGo21 分钟前
当你的 PHP 应用的 API 没有限流时会发生什么?
后端·php
JaguarJack23 分钟前
当你的 PHP 应用的 API 没有限流时会发生什么?
后端·php·服务端
摸鱼的春哥28 分钟前
Agent教程14:记忆才是Agent开发的核心
前端·javascript·后端
Victor35630 分钟前
MongoDB(20)如何更新MongoDB集合中的文档?
后端
Victor35633 分钟前
MongoDB(21)如何删除MongoDB集合中的文档?
后端
风象南9 小时前
很多人说,AI 让技术平权了,小白也能乱杀老师傅 ?
人工智能·后端
雨中飘荡的记忆10 小时前
ElasticJob分布式调度从入门到实战
java·后端
Se7en25810 小时前
推理平台全景
后端
大漠_w3cpluscom10 小时前
你学不会 CSS,不是笨,是方向错了
后端