サービス層のspringservice.xmlファイル

<?xml version = "1.0"エンコード= "UTF-8"?> 
<豆のxmlns = "http://www.springframework.org/schema/beans"
のxmlns:XSI = "http://www.w3.org / 2001 / XMLスキーマ・インスタンス"
のxmlns:コンテキスト= "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/beans
http://www.springframework.org/schema/beans/spring-beans。 XSD
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
ます。http://www.springframework。ORG /スキーマ/ 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 ">

<! -ターン注釈がスキャン- >
<コンテキスト:コンポーネントベース・パッケージ・スキャン=" cn.gxkj.service "/>

<! -データソースプロファイル導入DAO - >
<=リソースのインポート" CLASSPATH:春/ springdao.xml "/>

<! -トランザクション管理オブジェクトを設定- >
<豆を上記のid ="のTransactionManager "クラス=" org.springframework.jdbc.datasource.DataSourceTransactionManager ">
<プロパティ名="データソース「参照= "データソース" />
</豆>

< -コンフィギュレーション・サービス発表- >!
<TX:上記のIDをアドバイス= "txAdvice"トランザクション・マネージャは= "のTransactionManager">
<TX:属性>
<TX:メソッド名= "見つける*"読み取り専用= "true"を伝播= "SUPPORTS" />
<TX:メソッド名= "追加"伝播= "REQUIRED"ロールバック用= "例外" />
<TX:メソッド名= "UPD"伝播= "REQUIRED"ロールバック用= "例外" />
<TX:メソッド名= "検索*"読み取り専用= "true"を伝播= "SUPPORTS" />
<TX:メソッド名= "取得*"読み取り専用= "true"を伝播= "SUPPORTS" />
<TX:メソッド名= "*"読み取り専用= "false"を伝播= "REQUIRED"ロールバック用= "例外" />
</ TX:>属性
</ TX:アドバイス>
< - -切面配置!>
<AOP:config>の
<AOP:顧問のアドバイス-REF = "txAdvice"ポイントカット= "実行(* cn.gxkj.service.impl * *(..)。。)" />
</ AOP:config>の

</豆>

おすすめ

転載: www.cnblogs.com/dingyi-boss/p/11480005.html