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

相关推荐
hekung几秒前
maven的lifecycle与idea的run
java·maven
阿维的博客日记7 分钟前
为什么 ConcurrentHashMap 采用 synchronized 加锁而不采用ReentrantLock
java·juc
阿丰资源15 分钟前
java项目(附资料)-基于SpringBoot+MyBatisPlus+MySQL+Layui的药品管理系统
java·spring boot·mysql
云恒要逆袭16 分钟前
Java SE、EE、ME到底啥区别?我被这个问题困扰了一整年
java·java ee
鱼鳞_23 分钟前
Java学习笔记_Day27(Stream流)
java·笔记·学习
身如柳絮随风扬23 分钟前
Servlet:访问流程、核心接口与生命周期
java·servlet·web
indexsunny23 分钟前
互联网大厂Java面试实战:从Spring Boot到微服务架构的深度探讨
java·数据库·spring boot·安全·微服务·监控·面试实战
夕除24 分钟前
javaweb--03
java
m0_6779048441 分钟前
K8s学习
java·学习·kubernetes
逸风尊者42 分钟前
2026 主流 Claw 类产品技术报告
人工智能·后端·算法