Skip to content

Commit ce917d5

Browse files
committed
Polishing around @EnableTransactionManagement
Issue: SPR-10864
1 parent e8dead2 commit ce917d5

File tree

5 files changed

+13
-15
lines changed

5 files changed

+13
-15
lines changed

spring-context/src/main/java/org/springframework/context/annotation/AdviceModeImportSelector.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ protected String getAdviceModeAttributeName() {
6060
*/
6161
@Override
6262
public final String[] selectImports(AnnotationMetadata importingClassMetadata) {
63-
Class<?> annoType = GenericTypeResolver.resolveTypeArgument(this.getClass(), AdviceModeImportSelector.class);
63+
Class<?> annoType = GenericTypeResolver.resolveTypeArgument(getClass(), AdviceModeImportSelector.class);
6464
AnnotationAttributes attributes = AnnotationConfigUtils.attributesFor(importingClassMetadata, annoType);
6565
Assert.notNull(attributes, String.format(
6666
"@%s is not present on importing class '%s' as expected",

spring-context/src/main/java/org/springframework/context/annotation/AutoProxyRegistrar.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*
1+
/*
22
* Copyright 2002-2013 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -20,6 +20,7 @@
2020

2121
import org.apache.commons.logging.Log;
2222
import org.apache.commons.logging.LogFactory;
23+
2324
import org.springframework.aop.config.AopConfigUtils;
2425
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
2526
import org.springframework.core.annotation.AnnotationAttributes;
@@ -31,8 +32,8 @@
3132
* {@code proxyTargetClass} attributes set to the correct values.
3233
*
3334
* @author Chris Beams
34-
* @see EnableAspectJAutoProxy
3535
* @since 3.1
36+
* @see EnableAspectJAutoProxy
3637
*/
3738
public class AutoProxyRegistrar implements ImportBeanDefinitionRegistrar {
3839

@@ -45,7 +46,6 @@ public class AutoProxyRegistrar implements ImportBeanDefinitionRegistrar {
4546
* attributes. If {@code mode} is set to {@code PROXY}, the APC is registered; if
4647
* {@code proxyTargetClass} is set to {@code true}, then the APC is forced to use
4748
* subclass (CGLIB) proxying.
48-
*
4949
* <p>Several {@code @Enable*} annotations expose both {@code mode} and
5050
* {@code proxyTargetClass} attributes. It is important to note that most of these
5151
* capabilities end up sharing a {@linkplain AopConfigUtils#AUTO_PROXY_CREATOR_BEAN_NAME
@@ -62,13 +62,12 @@ public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, B
6262
AnnotationAttributes candidate = AnnotationConfigUtils.attributesFor(importingClassMetadata, annoType);
6363
Object mode = candidate.get("mode");
6464
Object proxyTargetClass = candidate.get("proxyTargetClass");
65-
if (mode != null && proxyTargetClass != null
66-
&& mode.getClass().equals(AdviceMode.class)
67-
&& proxyTargetClass.getClass().equals(Boolean.class)) {
65+
if (mode != null && proxyTargetClass != null && mode.getClass().equals(AdviceMode.class) &&
66+
proxyTargetClass.getClass().equals(Boolean.class)) {
6867
candidateFound = true;
6968
if (mode == AdviceMode.PROXY) {
7069
AopConfigUtils.registerAutoProxyCreatorIfNecessary(registry);
71-
if ((Boolean)proxyTargetClass) {
70+
if ((Boolean) proxyTargetClass) {
7271
AopConfigUtils.forceAutoProxyCreatorToUseClassProxying(registry);
7372
return;
7473
}
@@ -87,4 +86,5 @@ public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, B
8786
"altogether.", name, name, name));
8887
}
8988
}
89+
9090
}

spring-tx/src/main/java/org/springframework/transaction/annotation/EnableTransactionManagement.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2013 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -145,7 +145,6 @@
145145
* opposed to standard Java interface-based proxies ({@code false}). The default is
146146
* {@code false}. <strong>Applicable only if {@link #mode()} is set to
147147
* {@link AdviceMode#PROXY}</strong>.
148-
*
149148
* <p>Note that setting this attribute to {@code true} will affect <em>all</em>
150149
* Spring-managed beans requiring proxying, not just those marked with
151150
* {@code @Transactional}. For example, other beans marked with Spring's
@@ -168,4 +167,5 @@
168167
* The default is {@link Ordered#LOWEST_PRECEDENCE}.
169168
*/
170169
int order() default Ordered.LOWEST_PRECEDENCE;
170+
171171
}

spring-tx/src/main/java/org/springframework/transaction/annotation/ProxyTransactionManagementConfiguration.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2013 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -40,8 +40,7 @@ public class ProxyTransactionManagementConfiguration extends AbstractTransaction
4040
@Bean(name=TransactionManagementConfigUtils.TRANSACTION_ADVISOR_BEAN_NAME)
4141
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
4242
public BeanFactoryTransactionAttributeSourceAdvisor transactionAdvisor() {
43-
BeanFactoryTransactionAttributeSourceAdvisor advisor =
44-
new BeanFactoryTransactionAttributeSourceAdvisor();
43+
BeanFactoryTransactionAttributeSourceAdvisor advisor = new BeanFactoryTransactionAttributeSourceAdvisor();
4544
advisor.setTransactionAttributeSource(transactionAttributeSource());
4645
advisor.setAdvice(transactionInterceptor());
4746
advisor.setOrder(this.enableTx.<Integer>getNumber("order"));

spring-tx/src/main/java/org/springframework/transaction/annotation/TransactionManagementConfigurationSelector.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@
3232
* @see ProxyTransactionManagementConfiguration
3333
* @see TransactionManagementConfigUtils#TRANSACTION_ASPECT_CONFIGURATION_CLASS_NAME
3434
*/
35-
public class TransactionManagementConfigurationSelector
36-
extends AdviceModeImportSelector<EnableTransactionManagement> {
35+
public class TransactionManagementConfigurationSelector extends AdviceModeImportSelector<EnableTransactionManagement> {
3736

3837
/**
3938
* {@inheritDoc}

0 commit comments

Comments
 (0)