spring/applicationContext-service.xml
(完整代码) 2KB<?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:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<!-- 扫描 -->
<context:component-scan base-package="com.yh.service"></context:component-scan>
<!-- 事物核心管理对象,封装了事物的所有操作,依赖数据库连接池 -->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"></property>
</bean>
<!-- 配置事务通知 -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<!--
isolation (事务的隔离性)
read-only (是否只读 true或false)
propagation (事务的传播行为)
-->
<tx:method name="save*" isolation="REPEATABLE_READ" read-only="false" propagation="REQUIRED"/>
<tx:method name="add*" isolation="REPEATABLE_READ" read-only="false" propagation="REQUIRED"/>
<tx:method name="update*" isolation="REPEATABLE_READ" read-only="false" propagation="REQUIRED"/>
<tx:method name="modify*" isolation="REPEATABLE_READ" read-only="false" propagation="REQUIRED"/>
<tx:method name="delete*" isolation="REPEATABLE_READ" read-only="false" propagation="REQUIRED"/>
<tx:method name="remove*" isolation="REPEATABLE_READ" read-only="false" propagation="REQUIRED"/>
<tx:method name="get*" isolation="REPEATABLE_READ" read-only="true" propagation="REQUIRED"/>
<tx:method name="find*" isolation="REPEATABLE_READ" read-only="true" propagation="REQUIRED"/>
<tx:method name="fen*" isolation="REPEATABLE_READ" read-only="true" propagation="REQUIRED"/>
<tx:method name="sel*" isolation="REPEATABLE_READ" read-only="true" propagation="REQUIRED"/>
<tx:method name="tranferMoney" isolation="REPEATABLE_READ" read-only="false" propagation="REQUIRED"/>
</tx:attributes>
</tx:advice>
<!-- 配置将通知织入对象 -->
<aop:config>
<!-- 配置切入点 -->
<aop:pointcut expression="execution(* com.yh.service..*ServiceImpl.*(..))" id="pc"/>
<!-- 配置切面 切入点 + 增强 -->
<aop:advisor advice-ref="txAdvice" pointcut-ref="pc"/>
</aop:config>
</beans>
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。