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

相关推荐
神奇小汤圆几秒前
架构师必备:分布式锁方案选型
后端
shengjk111 分钟前
付费上班的时代,真的来了
后端
唐青枫13 分钟前
Java Picocli 实战详解:用注解写出好用的命令行工具
java
玉鸯13 分钟前
旧概念还是新范式?Agent 框架集体"图化"背后的矛盾与必然
后端·llm·agent
倾颜28 分钟前
断线之后,不要重跑 AI:在 POST + NDJSON 中实现可恢复 Agent 流
前端·后端·agent
X-⃢_⃢-X31 分钟前
四、OpenFeign远程调用
java·微服务·springboot·springcloud
程序员黑豆37 分钟前
鸿蒙应用开发之父子组件传参:@Prop 装饰器使用教程
前端·后端·harmonyos
减瓦38 分钟前
深入 Quarkus:云原生时代 Java 的重生之路
java·开发语言·云原生
杨运交1 小时前
[053][核心模块]Java枚举缓存与ORM集成实践
java·开发语言·缓存
程序员黑豆1 小时前
鸿蒙应用开发之V2状态管理:@Local、@ObservedV2、@Trace 使用教程
前端·后端·harmonyos