diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AbstractAutoProxyCreator.java b/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AbstractAutoProxyCreator.java index 729343083bb..0174ab0aa73 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AbstractAutoProxyCreator.java +++ b/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AbstractAutoProxyCreator.java @@ -55,26 +55,25 @@ import org.springframework.util.StringUtils; * before invoking the bean itself. * *
This class distinguishes between "common" interceptors: shared for all proxies it - * creates, and "specific" interceptors: unique per bean instance. There need not - * be any common interceptors. If there are, they are set using the interceptorNames - * property. As with ProxyFactoryBean, interceptors names in the current factory - * are used rather than bean references to allow correct handling of prototype - * advisors and interceptors: for example, to support stateful mixins. - * Any advice type is supported for "interceptorNames" entries. + * creates, and "specific" interceptors: unique per bean instance. There need not be any + * common interceptors. If there are, they are set using the interceptorNames property. + * As with {@link org.springframework.aop.framework.ProxyFactoryBean}, interceptors names + * in the current factory are used rather than bean references to allow correct handling + * of prototype advisors and interceptors: for example, to support stateful mixins. + * Any advice type is supported for {@link #setInterceptorNames "interceptorNames"} entries. * *
Such auto-proxying is particularly useful if there's a large number of beans that * need to be wrapped with similar proxies, i.e. delegating to the same interceptors. * Instead of x repetitive proxy definitions for x target beans, you can register * one single such post processor with the bean factory to achieve the same effect. * - *
Subclasses can apply any strategy to decide if a bean is to be proxied, - * e.g. by type, by name, by definition details, etc. They can also return - * additional interceptors that should just be applied to the specific bean - * instance. The default concrete implementation is BeanNameAutoProxyCreator, - * identifying the beans to be proxied via a list of bean names. + *
Subclasses can apply any strategy to decide if a bean is to be proxied, e.g. by type, + * by name, by definition details, etc. They can also return additional interceptors that + * should just be applied to the specific bean instance. A simple concrete implementation is + * {@link BeanNameAutoProxyCreator}, identifying the beans to be proxied via given names. * *
Any number of {@link TargetSourceCreator} implementations can be used to create - * a custom target source - for example, to pool prototype objects. Auto-proxying will + * a custom target source: for example, to pool prototype objects. Auto-proxying will * occur even if there is no advice, as long as a TargetSourceCreator specifies a custom * {@link org.springframework.aop.TargetSource}. If there are no TargetSourceCreators set, * or if none matches, a {@link org.springframework.aop.target.SingletonTargetSource} @@ -156,8 +155,8 @@ public abstract class AbstractAutoProxyCreator extends ProxyProcessorSupport } /** - * Specify the AdvisorAdapterRegistry to use. - * Default is the global AdvisorAdapterRegistry. + * Specify the {@link AdvisorAdapterRegistry} to use. + *
Default is the global {@link AdvisorAdapterRegistry}. * @see org.springframework.aop.framework.adapter.GlobalAdvisorAdapterRegistry */ public void setAdvisorAdapterRegistry(AdvisorAdapterRegistry advisorAdapterRegistry) { @@ -165,18 +164,18 @@ public abstract class AbstractAutoProxyCreator extends ProxyProcessorSupport } /** - * Set custom TargetSourceCreators to be applied in this order. - * If the list is empty, or they all return null, a SingletonTargetSource + * Set custom {@code TargetSourceCreators} to be applied in this order. + * If the list is empty, or they all return null, a {@link SingletonTargetSource} * will be created for each bean. *
Note that TargetSourceCreators will kick in even for target beans - * where no advices or advisors have been found. If a TargetSourceCreator - * returns a TargetSource for a specific bean, that bean will be proxied + * where no advices or advisors have been found. If a {@code TargetSourceCreator} + * returns a {@link TargetSource} for a specific bean, that bean will be proxied * in any case. - *
TargetSourceCreators can only be invoked if this post processor is used - * in a BeanFactory, and its BeanFactoryAware callback is used. - * @param targetSourceCreators list of TargetSourceCreator. - * Ordering is significant: The TargetSource returned from the first matching - * TargetSourceCreator (that is, the first that returns non-null) will be used. + *
{@code TargetSourceCreators} can only be invoked if this post processor is used + * in a {@link BeanFactory} and its {@link BeanFactoryAware} callback is triggered. + * @param targetSourceCreators the list of {@code TargetSourceCreators}. + * Ordering is significant: The {@code TargetSource} returned from the first matching + * {@code TargetSourceCreator} (that is, the first that returns non-null) will be used. */ public void setCustomTargetSourceCreators(TargetSourceCreator... targetSourceCreators) { this.customTargetSourceCreators = targetSourceCreators; @@ -207,8 +206,8 @@ public abstract class AbstractAutoProxyCreator extends ProxyProcessorSupport } /** - * Return the owning BeanFactory. - * May be {@code null}, as this object doesn't need to belong to a bean factory. + * Return the owning {@link BeanFactory}. + * May be {@code null}, as this post-processor doesn't need to belong to a bean factory. */ protected BeanFactory getBeanFactory() { return this.beanFactory; diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/MergedBeanDefinitionPostProcessor.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/MergedBeanDefinitionPostProcessor.java index d9846442a9f..02d050aeadc 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/MergedBeanDefinitionPostProcessor.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/MergedBeanDefinitionPostProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2016 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,20 +20,20 @@ import org.springframework.beans.factory.config.BeanPostProcessor; /** * Post-processor callback interface for merged bean definitions at runtime. - * {@link BeanPostProcessor} implementations may implement this sub-interface in - * order to post-process the merged bean definition that the Spring BeanFactory - * uses to create a specific bean instance. + * {@link BeanPostProcessor} implementations may implement this sub-interface in order + * to post-process the merged bean definition (a processed copy of the original bean + * definition) that the Spring {@code BeanFactory} uses to create a bean instance. * *
The {@link #postProcessMergedBeanDefinition} method may for example introspect * the bean definition in order to prepare some cached metadata before post-processing - * actual instances of a bean. It is also allowed to modify the bean definition - * but only for bean definition properties which are actually intended - * for concurrent modification. Basically, this only applies to operations - * defined on the {@link RootBeanDefinition} itself but not to the properties - * of its base classes. + * actual instances of a bean. It is also allowed to modify the bean definition but + * only for definition properties which are actually intended for concurrent + * modification. Essentially, this only applies to operations defined on the + * {@link RootBeanDefinition} itself but not to the properties of its base classes. * * @author Juergen Hoeller * @since 2.5 + * @see org.springframework.beans.factory.config.ConfigurableBeanFactory#getMergedBeanDefinition */ public interface MergedBeanDefinitionPostProcessor extends BeanPostProcessor { diff --git a/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassPostProcessor.java b/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassPostProcessor.java index 681282ff69e..53ca8273c89 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassPostProcessor.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassPostProcessor.java @@ -435,11 +435,6 @@ public class ConfigurationClassPostProcessor implements BeanDefinitionRegistryPo } return bean; } - - @Override - public Object postProcessAfterInitialization(Object bean, String beanName) { - return bean; - } } } diff --git a/spring-jms/src/main/java/org/springframework/jms/config/JmsListenerEndpointRegistrar.java b/spring-jms/src/main/java/org/springframework/jms/config/JmsListenerEndpointRegistrar.java index af540e59a7b..ad042cb8bf0 100644 --- a/spring-jms/src/main/java/org/springframework/jms/config/JmsListenerEndpointRegistrar.java +++ b/spring-jms/src/main/java/org/springframework/jms/config/JmsListenerEndpointRegistrar.java @@ -28,8 +28,7 @@ import org.springframework.messaging.handler.annotation.support.MessageHandlerMe import org.springframework.util.Assert; /** - * Helper bean for registering {@link JmsListenerEndpoint} with - * a {@link JmsListenerEndpointRegistry}. + * Helper bean for registering {@link JmsListenerEndpoint} with a {@link JmsListenerEndpointRegistry}. * * @author Stephane Nicoll * @author Juergen Hoeller diff --git a/src/test/java/org/springframework/aop/config/AopNamespaceHandlerScopeIntegrationTests.java b/src/test/java/org/springframework/aop/config/AopNamespaceHandlerScopeIntegrationTests.java index 067a3351662..41f6524863c 100644 --- a/src/test/java/org/springframework/aop/config/AopNamespaceHandlerScopeIntegrationTests.java +++ b/src/test/java/org/springframework/aop/config/AopNamespaceHandlerScopeIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2016 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. @@ -16,14 +16,9 @@ package org.springframework.aop.config; -import static java.lang.String.format; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; - import org.junit.Before; import org.junit.Test; + import org.springframework.aop.framework.Advised; import org.springframework.aop.support.AopUtils; import org.springframework.context.ApplicationContext; @@ -37,31 +32,35 @@ import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.context.support.XmlWebApplicationContext; +import static java.lang.String.format; +import static org.junit.Assert.*; + /** * Integration tests for scoped proxy use in conjunction with aop: namespace. * Deemed an integration test because .web mocks and application contexts are required. * - * @see org.springframework.aop.config.AopNamespaceHandlerTests - * * @author Rob Harrop * @author Juergen Hoeller * @author Chris Beams + * @see org.springframework.aop.config.AopNamespaceHandlerTests */ -public final class AopNamespaceHandlerScopeIntegrationTests { +public class AopNamespaceHandlerScopeIntegrationTests { - private static final String CLASSNAME = AopNamespaceHandlerScopeIntegrationTests.class.getName(); - private static final String CONTEXT = format("classpath:%s-context.xml", ClassUtils.convertClassNameToResourcePath(CLASSNAME)); + private static final String CONTEXT = format("classpath:%s-context.xml", + ClassUtils.convertClassNameToResourcePath(AopNamespaceHandlerScopeIntegrationTests.class.getName())); private ApplicationContext context; + @Before public void setUp() { XmlWebApplicationContext wac = new XmlWebApplicationContext(); - wac.setConfigLocations(new String[] {CONTEXT}); + wac.setConfigLocations(CONTEXT); wac.refresh(); this.context = wac; } + @Test public void testSingletonScoping() throws Exception { ITestBean scoped = (ITestBean) this.context.getBean("singletonScoped");