Skip to content

Commit

Permalink
Update Javadoc regarding reactive tx mgmt support
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrannen committed May 8, 2020
1 parent e1b2caf commit 0f22a5e
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 23 deletions.
@@ -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");
* you may not use this file except in compliance with the License.
Expand All @@ -19,8 +19,8 @@
import org.springframework.lang.Nullable;

/**
* This is the central interface in Spring's transaction infrastructure.
* Applications can use this directly, but it is not primarily meant as API:
* This is the central interface in Spring's imperative transaction infrastructure.
* Applications can use this directly, but it is not primarily meant as an API:
* Typically, applications will work with either TransactionTemplate or
* declarative transaction demarcation through AOP.
*
Expand All @@ -41,6 +41,7 @@
* @since 16.05.2003
* @see org.springframework.transaction.support.TransactionTemplate
* @see org.springframework.transaction.interceptor.TransactionInterceptor
* @see org.springframework.transaction.ReactiveTransactionManager
*/
public interface PlatformTransactionManager extends TransactionManager {

Expand Down
@@ -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");
* you may not use this file except in compliance with the License.
Expand All @@ -22,7 +22,7 @@

/**
* This is the central interface in Spring's reactive transaction infrastructure.
* Applications can use this directly, but it is not primarily meant as API:
* Applications can use this directly, but it is not primarily meant as an API:
* Typically, applications will work with either transactional operators or
* declarative transaction demarcation through AOP.
*
Expand All @@ -31,6 +31,7 @@
* @since 5.2
* @see org.springframework.transaction.reactive.TransactionalOperator
* @see org.springframework.transaction.interceptor.TransactionInterceptor
* @see org.springframework.transaction.PlatformTransactionManager
*/
public interface ReactiveTransactionManager extends TransactionManager {

Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2020 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.
Expand Down Expand Up @@ -30,7 +30,14 @@
* Enables Spring's annotation-driven transaction management capability, similar to
* the support found in Spring's {@code <tx:*>} XML namespace. To be used on
* {@link org.springframework.context.annotation.Configuration @Configuration}
* classes as follows:
* classes to configure traditional, imperative transaction management or
* reactive transaction management.
*
* <p>The following example demonstrates imperative transaction management
* using a {@link org.springframework.transaction.PlatformTransactionManager
* PlatformTransactionManager}. For reactive transaction management, configure a
* {@link org.springframework.transaction.ReactiveTransactionManager
* ReactiveTransactionManager} instead.
*
* <pre class="code">
* &#064;Configuration
Expand Down Expand Up @@ -83,12 +90,12 @@
* methods are invoked.
*
* <p>A minor difference between the two examples lies in the naming of the {@code
* PlatformTransactionManager} bean: In the {@code @Bean} case, the name is
* TransactionManager} bean: In the {@code @Bean} case, the name is
* <em>"txManager"</em> (per the name of the method); in the XML case, the name is
* <em>"transactionManager"</em>. The {@code <tx:annotation-driven/>} is hard-wired to
* look for a bean named "transactionManager" by default, however
* {@code @EnableTransactionManagement} is more flexible; it will fall back to a by-type
* lookup for any {@code PlatformTransactionManager} bean in the container. Thus the name
* lookup for any {@code TransactionManager} bean in the container. Thus the name
* can be "txManager", "transactionManager", or "tm": it simply does not matter.
*
* <p>For those that wish to establish a more direct relationship between
Expand Down Expand Up @@ -123,8 +130,8 @@
* }
* }</pre>
*
* This approach may be desirable simply because it is more explicit, or it may be
* necessary in order to distinguish between two {@code PlatformTransactionManager} beans
* <p>This approach may be desirable simply because it is more explicit, or it may be
* necessary in order to distinguish between two {@code TransactionManager} beans
* present in the same container. As the name suggests, the
* {@code annotationDrivenTransactionManager()} will be the one used for processing
* {@code @Transactional} methods. See {@link TransactionManagementConfigurer} Javadoc
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2020 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.
Expand Down Expand Up @@ -71,12 +71,14 @@

/**
* A <em>qualifier</em> value for the specified transaction.
* <p>May be used to determine the target transaction manager,
* matching the qualifier value (or the bean name) of a specific
* {@link org.springframework.transaction.PlatformTransactionManager}
* <p>May be used to determine the target transaction manager, matching the
* qualifier value (or the bean name) of a specific
* {@link org.springframework.transaction.TransactionManager TransactionManager}
* bean definition.
* @since 4.2
* @see #value
* @see org.springframework.transaction.PlatformTransactionManager
* @see org.springframework.transaction.ReactiveTransactionManager
*/
@AliasFor("value")
String transactionManager() default "";
Expand Down
Expand Up @@ -70,8 +70,8 @@
* management, and a {@link TransactionAttributeSource} (e.g. annotation-based) is used
* for determining transaction definitions for a particular class or method.
*
* <p>A transaction aspect is serializable if its {@code PlatformTransactionManager}
* and {@code TransactionAttributeSource} are serializable.
* <p>A transaction aspect is serializable if its {@code TransactionManager} and
* {@code TransactionAttributeSource} are serializable.
*
* @author Rod Johnson
* @author Juergen Hoeller
Expand Down Expand Up @@ -282,15 +282,15 @@ public TransactionAttributeSource getTransactionAttributeSource() {
}

/**
* Set the BeanFactory to use for retrieving PlatformTransactionManager beans.
* Set the BeanFactory to use for retrieving {@code TransactionManager} beans.
*/
@Override
public void setBeanFactory(@Nullable BeanFactory beanFactory) {
this.beanFactory = beanFactory;
}

/**
* Return the BeanFactory to use for retrieving PlatformTransactionManager beans.
* Return the BeanFactory to use for retrieving {@code TransactionManager} beans.
*/
@Nullable
protected final BeanFactory getBeanFactory() {
Expand Down Expand Up @@ -318,7 +318,8 @@ public void afterPropertiesSet() {
/**
* General delegate for around-advice-based subclasses, delegating to several other template
* methods on this class. Able to handle {@link CallbackPreferringPlatformTransactionManager}
* as well as regular {@link PlatformTransactionManager} implementations.
* as well as regular {@link PlatformTransactionManager} implementations and
* {@link ReactiveTransactionManager} implementations for reactive return types.
* @param method the Method being invoked
* @param targetClass the target class that we're invoking the method on
* @param invocation the callback to use for proceeding with the target invocation
Expand Down
6 changes: 3 additions & 3 deletions src/docs/asciidoc/data-access.adoc
Expand Up @@ -1160,7 +1160,7 @@ the default transactional configuration, you could write the following:
</tx:attributes>
</tx:advice>
<!-- other transaction infrastructure beans such as a PlatformTransactionManager omitted... -->
<!-- other transaction infrastructure beans such as a TransactionManager omitted... -->
</beans>
----
Expand Down Expand Up @@ -1216,7 +1216,7 @@ transactional settings:
</tx:attributes>
</tx:advice>
<!-- other transaction infrastructure beans such as a PlatformTransactionManager omitted... -->
<!-- other transaction infrastructure beans such as a TransactionManager omitted... -->
</beans>
----
Expand Down Expand Up @@ -1385,7 +1385,7 @@ In XML configuration, the `<tx:annotation-driven/>` tag provides similar conveni
<bean id="fooService" class="x.y.service.DefaultFooService"/>
<!-- enable the configuration of transactional behavior based on annotations -->
<tx:annotation-driven transaction-manager="txManager"/><!-- a PlatformTransactionManager is still required --> <1>
<tx:annotation-driven transaction-manager="txManager"/><!-- a TransactionManager is still required --> <1>
<bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<!-- (this dependency is defined somewhere else) -->
Expand Down

0 comments on commit 0f22a5e

Please sign in to comment.