Skip to content

Commit fc629bb

Browse files
committed
Polishing
1 parent a5c6658 commit fc629bb

File tree

6 files changed

+52
-60
lines changed

6 files changed

+52
-60
lines changed

spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AbstractAutoProxyCreator.java

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -55,26 +55,25 @@
5555
* before invoking the bean itself.
5656
*
5757
* <p>This class distinguishes between "common" interceptors: shared for all proxies it
58-
* creates, and "specific" interceptors: unique per bean instance. There need not
59-
* be any common interceptors. If there are, they are set using the interceptorNames
60-
* property. As with ProxyFactoryBean, interceptors names in the current factory
61-
* are used rather than bean references to allow correct handling of prototype
62-
* advisors and interceptors: for example, to support stateful mixins.
63-
* Any advice type is supported for "interceptorNames" entries.
58+
* creates, and "specific" interceptors: unique per bean instance. There need not be any
59+
* common interceptors. If there are, they are set using the interceptorNames property.
60+
* As with {@link org.springframework.aop.framework.ProxyFactoryBean}, interceptors names
61+
* in the current factory are used rather than bean references to allow correct handling
62+
* of prototype advisors and interceptors: for example, to support stateful mixins.
63+
* Any advice type is supported for {@link #setInterceptorNames "interceptorNames"} entries.
6464
*
6565
* <p>Such auto-proxying is particularly useful if there's a large number of beans that
6666
* need to be wrapped with similar proxies, i.e. delegating to the same interceptors.
6767
* Instead of x repetitive proxy definitions for x target beans, you can register
6868
* one single such post processor with the bean factory to achieve the same effect.
6969
*
70-
* <p>Subclasses can apply any strategy to decide if a bean is to be proxied,
71-
* e.g. by type, by name, by definition details, etc. They can also return
72-
* additional interceptors that should just be applied to the specific bean
73-
* instance. The default concrete implementation is BeanNameAutoProxyCreator,
74-
* identifying the beans to be proxied via a list of bean names.
70+
* <p>Subclasses can apply any strategy to decide if a bean is to be proxied, e.g. by type,
71+
* by name, by definition details, etc. They can also return additional interceptors that
72+
* should just be applied to the specific bean instance. A simple concrete implementation is
73+
* {@link BeanNameAutoProxyCreator}, identifying the beans to be proxied via given names.
7574
*
7675
* <p>Any number of {@link TargetSourceCreator} implementations can be used to create
77-
* a custom target source - for example, to pool prototype objects. Auto-proxying will
76+
* a custom target source: for example, to pool prototype objects. Auto-proxying will
7877
* occur even if there is no advice, as long as a TargetSourceCreator specifies a custom
7978
* {@link org.springframework.aop.TargetSource}. If there are no TargetSourceCreators set,
8079
* or if none matches, a {@link org.springframework.aop.target.SingletonTargetSource}
@@ -128,11 +127,9 @@ public abstract class AbstractAutoProxyCreator extends ProxyProcessorSupport
128127

129128
private BeanFactory beanFactory;
130129

131-
private final Set<String> targetSourcedBeans =
132-
Collections.newSetFromMap(new ConcurrentHashMap<>(16));
130+
private final Set<String> targetSourcedBeans = Collections.newSetFromMap(new ConcurrentHashMap<>(16));
133131

134-
private final Set<Object> earlyProxyReferences =
135-
Collections.newSetFromMap(new ConcurrentHashMap<>(16));
132+
private final Set<Object> earlyProxyReferences = Collections.newSetFromMap(new ConcurrentHashMap<>(16));
136133

137134
private final Map<Object, Class<?>> proxyTypes = new ConcurrentHashMap<>(16);
138135

@@ -156,27 +153,27 @@ public boolean isFrozen() {
156153
}
157154

158155
/**
159-
* Specify the AdvisorAdapterRegistry to use.
160-
* Default is the global AdvisorAdapterRegistry.
156+
* Specify the {@link AdvisorAdapterRegistry} to use.
157+
* <p>Default is the global {@link AdvisorAdapterRegistry}.
161158
* @see org.springframework.aop.framework.adapter.GlobalAdvisorAdapterRegistry
162159
*/
163160
public void setAdvisorAdapterRegistry(AdvisorAdapterRegistry advisorAdapterRegistry) {
164161
this.advisorAdapterRegistry = advisorAdapterRegistry;
165162
}
166163

167164
/**
168-
* Set custom TargetSourceCreators to be applied in this order.
169-
* If the list is empty, or they all return null, a SingletonTargetSource
165+
* Set custom {@code TargetSourceCreators} to be applied in this order.
166+
* If the list is empty, or they all return null, a {@link SingletonTargetSource}
170167
* will be created for each bean.
171168
* <p>Note that TargetSourceCreators will kick in even for target beans
172-
* where no advices or advisors have been found. If a TargetSourceCreator
173-
* returns a TargetSource for a specific bean, that bean will be proxied
169+
* where no advices or advisors have been found. If a {@code TargetSourceCreator}
170+
* returns a {@link TargetSource} for a specific bean, that bean will be proxied
174171
* in any case.
175-
* <p>TargetSourceCreators can only be invoked if this post processor is used
176-
* in a BeanFactory, and its BeanFactoryAware callback is used.
177-
* @param targetSourceCreators list of TargetSourceCreator.
178-
* Ordering is significant: The TargetSource returned from the first matching
179-
* TargetSourceCreator (that is, the first that returns non-null) will be used.
172+
* <p>{@code TargetSourceCreators} can only be invoked if this post processor is used
173+
* in a {@link BeanFactory} and its {@link BeanFactoryAware} callback is triggered.
174+
* @param targetSourceCreators the list of {@code TargetSourceCreators}.
175+
* Ordering is significant: The {@code TargetSource} returned from the first matching
176+
* {@code TargetSourceCreator} (that is, the first that returns non-null) will be used.
180177
*/
181178
public void setCustomTargetSourceCreators(TargetSourceCreator... targetSourceCreators) {
182179
this.customTargetSourceCreators = targetSourceCreators;
@@ -207,8 +204,8 @@ public void setBeanFactory(BeanFactory beanFactory) {
207204
}
208205

209206
/**
210-
* Return the owning BeanFactory.
211-
* May be {@code null}, as this object doesn't need to belong to a bean factory.
207+
* Return the owning {@link BeanFactory}.
208+
* May be {@code null}, as this post-processor doesn't need to belong to a bean factory.
212209
*/
213210
protected BeanFactory getBeanFactory() {
214211
return this.beanFactory;

spring-beans/src/main/java/org/springframework/beans/factory/support/MergedBeanDefinitionPostProcessor.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2008 the original author or authors.
2+
* Copyright 2002-2016 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.
@@ -20,20 +20,20 @@
2020

2121
/**
2222
* Post-processor callback interface for <i>merged</i> bean definitions at runtime.
23-
* {@link BeanPostProcessor} implementations may implement this sub-interface in
24-
* order to post-process the merged bean definition that the Spring BeanFactory
25-
* uses to create a specific bean instance.
23+
* {@link BeanPostProcessor} implementations may implement this sub-interface in order
24+
* to post-process the merged bean definition (a processed copy of the original bean
25+
* definition) that the Spring {@code BeanFactory} uses to create a bean instance.
2626
*
2727
* <p>The {@link #postProcessMergedBeanDefinition} method may for example introspect
2828
* the bean definition in order to prepare some cached metadata before post-processing
29-
* actual instances of a bean. It is also allowed to modify the bean definition
30-
* but <i>only</i> for bean definition properties which are actually intended
31-
* for concurrent modification. Basically, this only applies to operations
32-
* defined on the {@link RootBeanDefinition} itself but not to the properties
33-
* of its base classes.
29+
* actual instances of a bean. It is also allowed to modify the bean definition but
30+
* <i>only</i> for definition properties which are actually intended for concurrent
31+
* modification. Essentially, this only applies to operations defined on the
32+
* {@link RootBeanDefinition} itself but not to the properties of its base classes.
3433
*
3534
* @author Juergen Hoeller
3635
* @since 2.5
36+
* @see org.springframework.beans.factory.config.ConfigurableBeanFactory#getMergedBeanDefinition
3737
*/
3838
public interface MergedBeanDefinitionPostProcessor extends BeanPostProcessor {
3939

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -437,11 +437,6 @@ public Object postProcessBeforeInitialization(Object bean, String beanName) {
437437
}
438438
return bean;
439439
}
440-
441-
@Override
442-
public Object postProcessAfterInitialization(Object bean, String beanName) {
443-
return bean;
444-
}
445440
}
446441

447442
}

spring-jms/src/main/java/org/springframework/jms/config/JmsListenerEndpointRegistrar.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@
2828
import org.springframework.util.Assert;
2929

3030
/**
31-
* Helper bean for registering {@link JmsListenerEndpoint} with
32-
* a {@link JmsListenerEndpointRegistry}.
31+
* Helper bean for registering {@link JmsListenerEndpoint} with a {@link JmsListenerEndpointRegistry}.
3332
*
3433
* @author Stephane Nicoll
3534
* @author Juergen Hoeller
@@ -48,8 +47,7 @@ public class JmsListenerEndpointRegistrar implements BeanFactoryAware, Initializ
4847

4948
private BeanFactory beanFactory;
5049

51-
private final List<JmsListenerEndpointDescriptor> endpointDescriptors =
52-
new ArrayList<>();
50+
private final List<JmsListenerEndpointDescriptor> endpointDescriptors = new ArrayList<>();
5351

5452
private boolean startImmediately;
5553

spring-web-reactive/src/test/java/org/springframework/web/reactive/FlushingIntegrationTests.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,14 @@ public class FlushingIntegrationTests extends AbstractHttpHandlerIntegrationTest
4545

4646
private WebClient webClient;
4747

48+
4849
@Before
4950
public void setup() throws Exception {
5051
super.setup();
5152
this.webClient = WebClient.create(new ReactorClientHttpConnector());
5253
}
5354

55+
5456
@Test
5557
public void writeAndFlushWith() throws Exception {
5658
ClientRequest<Void> request = ClientRequest.GET("http://localhost:" + port + "/write-and-flush").build();
@@ -93,11 +95,13 @@ public void writeAndAutoFlushBeforeComplete() {
9395
.verify(Duration.ofSeconds(10L));
9496
}
9597

98+
9699
@Override
97100
protected HttpHandler createHttpHandler() {
98101
return new FlushingHandler();
99102
}
100103

104+
101105
private static class FlushingHandler implements HttpHandler {
102106

103107
@Override
@@ -136,7 +140,6 @@ private DataBuffer toDataBuffer(String value, DataBufferFactory factory) {
136140
buffer.write(data);
137141
return buffer;
138142
}
139-
140143
}
141144

142145
}

src/test/java/org/springframework/aop/config/AopNamespaceHandlerScopeIntegrationTests.java

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2016 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.
@@ -16,14 +16,9 @@
1616

1717
package org.springframework.aop.config;
1818

19-
import static java.lang.String.format;
20-
import static org.junit.Assert.assertEquals;
21-
import static org.junit.Assert.assertFalse;
22-
import static org.junit.Assert.assertSame;
23-
import static org.junit.Assert.assertTrue;
24-
2519
import org.junit.Before;
2620
import org.junit.Test;
21+
2722
import org.springframework.aop.framework.Advised;
2823
import org.springframework.aop.support.AopUtils;
2924
import org.springframework.context.ApplicationContext;
@@ -37,31 +32,35 @@
3732
import org.springframework.web.context.request.ServletRequestAttributes;
3833
import org.springframework.web.context.support.XmlWebApplicationContext;
3934

35+
import static java.lang.String.format;
36+
import static org.junit.Assert.*;
37+
4038
/**
4139
* Integration tests for scoped proxy use in conjunction with aop: namespace.
4240
* Deemed an integration test because .web mocks and application contexts are required.
4341
*
44-
* @see org.springframework.aop.config.AopNamespaceHandlerTests
45-
*
4642
* @author Rob Harrop
4743
* @author Juergen Hoeller
4844
* @author Chris Beams
45+
* @see org.springframework.aop.config.AopNamespaceHandlerTests
4946
*/
5047
public class AopNamespaceHandlerScopeIntegrationTests {
5148

52-
private static final String CLASSNAME = AopNamespaceHandlerScopeIntegrationTests.class.getName();
53-
private static final String CONTEXT = format("classpath:%s-context.xml", ClassUtils.convertClassNameToResourcePath(CLASSNAME));
49+
private static final String CONTEXT = format("classpath:%s-context.xml",
50+
ClassUtils.convertClassNameToResourcePath(AopNamespaceHandlerScopeIntegrationTests.class.getName()));
5451

5552
private ApplicationContext context;
5653

54+
5755
@Before
5856
public void setUp() {
5957
XmlWebApplicationContext wac = new XmlWebApplicationContext();
60-
wac.setConfigLocations(new String[] {CONTEXT});
58+
wac.setConfigLocations(CONTEXT);
6159
wac.refresh();
6260
this.context = wac;
6361
}
6462

63+
6564
@Test
6665
public void testSingletonScoping() throws Exception {
6766
ITestBean scoped = (ITestBean) this.context.getBean("singletonScoped");

0 commit comments

Comments
 (0)