Browse Source
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3368 50f2f4bb-b051-0410-bef5-90022cba6387pull/1/head
4 changed files with 131 additions and 14 deletions
@ -0,0 +1,45 @@
@@ -0,0 +1,45 @@
|
||||
/* |
||||
* Copyright 2002-2010 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
package org.springframework.transaction.config; |
||||
|
||||
import org.springframework.beans.factory.annotation.Qualifier; |
||||
import org.springframework.context.annotation.Bean; |
||||
import org.springframework.context.annotation.Configuration; |
||||
import org.springframework.transaction.CallCountingTransactionManager; |
||||
import org.springframework.transaction.PlatformTransactionManager; |
||||
|
||||
/** |
||||
* @author Juergen Hoeller |
||||
*/ |
||||
@Configuration |
||||
public class TransactionManagerConfiguration { |
||||
|
||||
@Bean |
||||
@Qualifier("synch") |
||||
public PlatformTransactionManager transactionManager1() { |
||||
return new CallCountingTransactionManager(); |
||||
} |
||||
|
||||
@Bean |
||||
@Qualifier("noSynch") |
||||
public PlatformTransactionManager transactionManager2() { |
||||
CallCountingTransactionManager tm = new CallCountingTransactionManager(); |
||||
tm.setTransactionSynchronization(CallCountingTransactionManager.SYNCHRONIZATION_NEVER); |
||||
return tm; |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,25 @@
@@ -0,0 +1,25 @@
|
||||
<?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:aop="http://www.springframework.org/schema/aop" |
||||
xmlns:context="http://www.springframework.org/schema/context" |
||||
xmlns:tx="http://www.springframework.org/schema/tx" |
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd |
||||
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd |
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd |
||||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> |
||||
|
||||
<context:annotation-config/> |
||||
|
||||
<tx:annotation-driven proxy-target-class="true" order="0"/> |
||||
|
||||
<aop:config> |
||||
<aop:advisor advice-ref="txCheckingInterceptor" pointcut="execution(* *..TransactionalService.*(..))" order="1"/> |
||||
</aop:config> |
||||
|
||||
<bean id="txCheckingInterceptor" class="org.springframework.transaction.config.AnnotationDrivenTests$TransactionCheckingInterceptor"/> |
||||
|
||||
<bean id="transactionManagerConfig" class="org.springframework.transaction.config.TransactionManagerConfiguration"/> |
||||
|
||||
<bean id="service" class="org.springframework.transaction.config.TransactionalService"/> |
||||
|
||||
</beans> |
||||
Loading…
Reference in new issue