第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定

攔截的方式

我們公司使用的是攔截的方式。但是沒見老師講這一種。心里好沒底兒??!這種攔截的方式是否也是常用的。https://img1.sycdn.imooc.com//5cb9f3580001ccd208580560.jpg,

正在回答

1 回答

基于TransactionProxyFactoryBean的方式(實際開發(fā)種不經(jīng)常使用)

老師講過了。。。。。。。。


<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"

? ? ? ?xmlns:tx="http://www.springframework.org/schema/tx"

? ? ? ?xmlns:aop="http://www.springframework.org/schema/aop"

? ? ? ?xmlns:context="http://www.springframework.org/schema/context"

? ? ? ?xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

? ? ? ?xsi:schemaLocation="

? ? ? ?http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd

? ? ? ? http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd

? ? ? ? http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd

? ? ? ? http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd

">

? ? <!--配置數(shù)據(jù)源c3p0-->

? ? <bean class="com.mchange.v2.c3p0.ComboPooledDataSource" id="dataSource">

? ? ? ? <property name="driverClass" value="com.mysql.jdbc.Driver"/>

? ? ? ? <property name="jdbcUrl" value="jdbc:mysql://127.0.0.1:3306/test"/>

? ? ? ? <property name="user" value="root"/>

? ? ? ? <property name="password" value="root"/>

? ? </bean>


? ? <!--配置業(yè)務(wù)層實現(xiàn)類-->

? ? <bean class="spring.demo2.AccountServiceImpl" id="accountService">

? ? ? ? <property name="accountDao" ref="accountDao"/>

? ? </bean>


? ? <!--配置DAO類-->

? ? <bean class="spring.demo2.AccountDaoImpl" id="accountDao">

? ? ? ? <property name="dataSource" ref="dataSource"/>

? ? </bean>


? ? <!--配置事務(wù)管理器-->

? ? <bean class="org.springframework.jdbc.datasource.DataSourceTransactionManager" id="transactionManager">

? ? ? ? <property name="dataSource" ref="dataSource"/>

? ? </bean>


? ? <!--配置業(yè)務(wù)層的代理-->

? ? <bean class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"

? ? ? ? ? id="transactionProxyFactoryBean">

? ? ? ? <!--目標(biāo)對象-->

? ? ? ? <property name="target" ref="accountService"/>

? ? ? ? <!--注入事務(wù)管理器-->

? ? ? ? <property name="transactionManager" ref="transactionManager"/>

? ? ? ? <!--注入屬性-->

? ? ? ? <property name="transactionAttributes">

? ? ? ? ? ? <props>

? ? ? ? ? ? ? ? <!--

? ? ? ? ? ? ? ? prop的格式:

? ? ? ? ? ? ? ? PROPAGATION:事務(wù)傳播行為

? ? ? ? ? ? ? ? ISOLATIN:事務(wù)的隔離行為

? ? ? ? ? ? ? ? readOnly:只讀

? ? ? ? ? ? ? ? -Exception:發(fā)生哪些異?;貪L事務(wù)

? ? ? ? ? ? ? ? +Exception:發(fā)生哪些異常事務(wù)不回滾

? ? ? ? ? ? ? ? -->

? ? ? ? ? ? ? ? <!--*代表類中的所有方法-->

? ? ? ? ? ? ? ? <prop key="*">PROPAGATION_REQUIRED</prop>

? ? ? ? ? ? </props>

? ? ? ? </property>


? ? </bean>


</beans>





0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號