Browse Source

Deprecate PTM-based constructors in favor of generic TransactionManager

Closes gh-24612
pull/24679/head
Juergen Hoeller 6 years ago
parent
commit
193f419520
  1. 31
      spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionInterceptor.java

31
spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionInterceptor.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2019 the original author or authors. * Copyright 2002-2020 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -29,6 +29,7 @@ import org.springframework.aop.support.AopUtils;
import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.BeanFactory;
import org.springframework.lang.Nullable; import org.springframework.lang.Nullable;
import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.TransactionManager;
/** /**
* AOP Alliance MethodInterceptor for declarative transaction * AOP Alliance MethodInterceptor for declarative transaction
@ -65,13 +66,14 @@ public class TransactionInterceptor extends TransactionAspectSupport implements
/** /**
* Create a new TransactionInterceptor. * Create a new TransactionInterceptor.
* @param ptm the default transaction manager to perform the actual transaction management * @param ptm the default transaction manager to perform the actual transaction management
* @param attributes the transaction attributes in properties format * @param tas the attribute source to be used to find transaction attributes
* @since 5.2.5
* @see #setTransactionManager * @see #setTransactionManager
* @see #setTransactionAttributes(java.util.Properties) * @see #setTransactionAttributeSource
*/ */
public TransactionInterceptor(PlatformTransactionManager ptm, Properties attributes) { public TransactionInterceptor(TransactionManager ptm, TransactionAttributeSource tas) {
setTransactionManager(ptm); setTransactionManager(ptm);
setTransactionAttributes(attributes); setTransactionAttributeSource(tas);
} }
/** /**
@ -79,13 +81,30 @@ public class TransactionInterceptor extends TransactionAspectSupport implements
* @param ptm the default transaction manager to perform the actual transaction management * @param ptm the default transaction manager to perform the actual transaction management
* @param tas the attribute source to be used to find transaction attributes * @param tas the attribute source to be used to find transaction attributes
* @see #setTransactionManager * @see #setTransactionManager
* @see #setTransactionAttributeSource(TransactionAttributeSource) * @see #setTransactionAttributeSource
* @deprecated as of 5.2.5, in favor of
* {@link #TransactionInterceptor(TransactionManager, TransactionAttributeSource)}
*/ */
@Deprecated
public TransactionInterceptor(PlatformTransactionManager ptm, TransactionAttributeSource tas) { public TransactionInterceptor(PlatformTransactionManager ptm, TransactionAttributeSource tas) {
setTransactionManager(ptm); setTransactionManager(ptm);
setTransactionAttributeSource(tas); setTransactionAttributeSource(tas);
} }
/**
* Create a new TransactionInterceptor.
* @param ptm the default transaction manager to perform the actual transaction management
* @param attributes the transaction attributes in properties format
* @see #setTransactionManager
* @see #setTransactionAttributes(java.util.Properties)
* @deprecated as of 5.2.5, in favor of {@link #setTransactionAttributes(Properties)}
*/
@Deprecated
public TransactionInterceptor(PlatformTransactionManager ptm, Properties attributes) {
setTransactionManager(ptm);
setTransactionAttributes(attributes);
}
@Override @Override
@Nullable @Nullable

Loading…
Cancel
Save