Skip to content

Commit 494cc22

Browse files
committed
Polishing (along with SPR-10992)
1 parent 044d68b commit 494cc22

File tree

3 files changed

+18
-21
lines changed

3 files changed

+18
-21
lines changed

spring-aop/src/main/java/org/springframework/aop/scope/ScopedProxyUtils.java

+2-2
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.
@@ -54,7 +54,7 @@ public static BeanDefinitionHolder createScopedProxy(BeanDefinitionHolder defini
5454
// Create a scoped proxy definition for the original bean name,
5555
// "hiding" the target bean in an internal target definition.
5656
RootBeanDefinition proxyDefinition = new RootBeanDefinition(ScopedProxyFactoryBean.class);
57-
proxyDefinition.setOriginatingBeanDefinition(definition.getBeanDefinition());
57+
proxyDefinition.setOriginatingBeanDefinition(targetDefinition);
5858
proxyDefinition.setSource(definition.getSource());
5959
proxyDefinition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
6060

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

+1-3
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ public Map<String, Class<? extends BeanDefinitionReader>> getImportedResources()
165165
return this.importedResources;
166166
}
167167

168-
169168
public void validate(ProblemReporter problemReporter) {
170169
// A configuration class may not be final (CGLIB limitation)
171170
if (getMetadata().isAnnotated(Configuration.class.getName())) {
@@ -196,7 +195,6 @@ public void validate(ProblemReporter problemReporter) {
196195
}
197196
}
198197

199-
200198
@Override
201199
public boolean equals(Object other) {
202200
return (this == other || (other instanceof ConfigurationClass &&
@@ -210,7 +208,7 @@ public int hashCode() {
210208

211209
@Override
212210
public String toString() {
213-
return String.format("[ConfigurationClass:beanName=%s,resource=%s]", this.beanName, this.resource);
211+
return "ConfigurationClass:beanName=" + this.beanName + ",resource=" + this.resource;
214212
}
215213

216214

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

+15-16
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.
@@ -27,7 +27,6 @@
2727
import org.apache.commons.logging.Log;
2828
import org.apache.commons.logging.LogFactory;
2929

30-
import org.springframework.beans.BeansException;
3130
import org.springframework.beans.factory.BeanClassLoaderAware;
3231
import org.springframework.beans.factory.BeanDefinitionStoreException;
3332
import org.springframework.beans.factory.BeanFactory;
@@ -85,7 +84,7 @@
8584
* @since 3.0
8685
*/
8786
public class ConfigurationClassPostProcessor implements BeanDefinitionRegistryPostProcessor,
88-
ResourceLoaderAware, BeanClassLoaderAware, EnvironmentAware, Ordered {
87+
Ordered, ResourceLoaderAware, BeanClassLoaderAware, EnvironmentAware {
8988

9089
private static final String IMPORT_AWARE_PROCESSOR_BEAN_NAME =
9190
ConfigurationClassPostProcessor.class.getName() + ".importAwareProcessor";
@@ -130,6 +129,10 @@ protected String buildDefaultBeanName(BeanDefinition definition) {
130129
};
131130

132131

132+
public int getOrder() {
133+
return Ordered.HIGHEST_PRECEDENCE;
134+
}
135+
133136
/**
134137
* Set the {@link SourceExtractor} to use for generated bean definitions
135138
* that correspond to {@link Bean} factory methods.
@@ -368,21 +371,21 @@ public void enhanceConfigurationClasses(ConfigurableListableBeanFactory beanFact
368371
}
369372
}
370373

371-
@Override
372-
public int getOrder() {
373-
return Ordered.HIGHEST_PRECEDENCE;
374-
}
375374

376-
377-
private static class ImportAwareBeanPostProcessor implements PriorityOrdered, BeanFactoryAware, BeanPostProcessor {
375+
private static class ImportAwareBeanPostProcessor implements BeanPostProcessor, PriorityOrdered, BeanFactoryAware {
378376

379377
private BeanFactory beanFactory;
380378

381-
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
379+
public int getOrder() {
380+
return Ordered.HIGHEST_PRECEDENCE;
381+
}
382+
383+
@Override
384+
public void setBeanFactory(BeanFactory beanFactory) {
382385
this.beanFactory = beanFactory;
383386
}
384387

385-
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
388+
public Object postProcessBeforeInitialization(Object bean, String beanName) {
386389
if (bean instanceof ImportAware) {
387390
ImportRegistry importRegistry = this.beanFactory.getBean(IMPORT_REGISTRY_BEAN_NAME, ImportRegistry.class);
388391
String importingClass = importRegistry.getImportingClassFor(bean.getClass().getSuperclass().getName());
@@ -404,13 +407,9 @@ public Object postProcessBeforeInitialization(Object bean, String beanName) thro
404407
return bean;
405408
}
406409

407-
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
410+
public Object postProcessAfterInitialization(Object bean, String beanName) {
408411
return bean;
409412
}
410-
411-
public int getOrder() {
412-
return Ordered.HIGHEST_PRECEDENCE;
413-
}
414413
}
415414

416415
}

0 commit comments

Comments
 (0)