Polish Javadoc regarding default transaction manager

This commit is contained in:
Sam Brannen 2014-12-12 20:56:59 +01:00
parent eef0bf43d5
commit 5b5cf37ac5
5 changed files with 27 additions and 12 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 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.
@ -40,6 +40,9 @@ public abstract class AbstractTransactionManagementConfiguration implements Impo
protected AnnotationAttributes enableTx;
/**
* Default transaction manager.
*/
protected PlatformTransactionManager txManager;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2011 the original author or authors.
* Copyright 2002-2014 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.
@ -20,8 +20,8 @@ import org.springframework.transaction.PlatformTransactionManager;
/**
* Interface to be implemented by @{@link org.springframework.context.annotation.Configuration
* Configuration} classes annotated with @{@link EnableTransactionManagement} that wish
* or need to specify explicitly the {@link PlatformTransactionManager} bean to be used
* Configuration} classes annotated with @{@link EnableTransactionManagement} that wish to
* or need to explicitly specify the default {@link PlatformTransactionManager} bean to be used
* for annotation-driven transaction management, as opposed to the default approach of a
* by-type lookup. One reason this might be necessary is if there are two
* {@code PlatformTransactionManager} beans present in the container.
@ -42,7 +42,7 @@ import org.springframework.transaction.PlatformTransactionManager;
public interface TransactionManagementConfigurer {
/**
* Return the transaction manager bean to use for annotation-driven database
* Return the default transaction manager bean to use for annotation-driven database
* transaction management, i.e. when processing {@code @Transactional} methods.
*
* <p>There are two basic approaches to implementing this method:

View File

@ -58,6 +58,8 @@ import org.springframework.util.StringUtils;
*
* @author Rod Johnson
* @author Juergen Hoeller
* @author Stéphane Nicoll
* @author Sam Brannen
* @since 1.1
* @see #setTransactionManager
* @see #setTransactionAttributes
@ -120,8 +122,14 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init
protected final Log logger = LogFactory.getLog(getClass());
/**
* Default transaction manager bean name.
*/
private String transactionManagerBeanName;
/**
* Default transaction manager.
*/
private PlatformTransactionManager transactionManager;
private TransactionAttributeSource transactionAttributeSource;
@ -144,14 +152,18 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init
}
/**
* Specify the target transaction manager.
* Specify the <em>default</em> transaction manager to use to drive transactions.
* <p>The default transaction manager will be used if a <em>qualifier</em>
* has not been declared for a given transaction or if an explicit name for the
* default transaction manager bean has not been specified.
* @see #setTransactionManagerBeanName
*/
public void setTransactionManager(PlatformTransactionManager transactionManager) {
this.transactionManager = transactionManager;
}
/**
* Return the transaction manager, if specified.
* Return the default transaction manager, or {@code null} if unknown.
*/
public PlatformTransactionManager getTransactionManager() {
return this.transactionManager;
@ -351,7 +363,7 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init
return txManager;
}
else {
// Lookup the default transaction manager and store it for next call
// Look up the default transaction manager and cache it for subsequent calls
this.transactionManager = this.beanFactory.getBean(PlatformTransactionManager.class);
return this.transactionManager;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 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.
@ -62,7 +62,7 @@ public class TransactionInterceptor extends TransactionAspectSupport implements
/**
* Create a new TransactionInterceptor.
* @param ptm the 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
* @see #setTransactionManager
* @see #setTransactionAttributes(java.util.Properties)
@ -74,7 +74,7 @@ public class TransactionInterceptor extends TransactionAspectSupport implements
/**
* Create a new TransactionInterceptor.
* @param ptm the 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
* @see #setTransactionManager
* @see #setTransactionAttributeSource(TransactionAttributeSource)

View File

@ -120,7 +120,7 @@ public class TransactionProxyFactoryBean extends AbstractSingletonProxyFactoryBe
/**
* Set the transaction manager. This will perform actual
* Set the default transaction manager. This will perform actual
* transaction management: This class is just a way of invoking it.
* @see TransactionInterceptor#setTransactionManager
*/