Avoid unnecessary processing in ApplicationContextAwareProcessor
This commit avoids unnecessary processing in the implementation of postProcessBeforeInitialization() in ApplicationContextAwareProcessor by immediately returning the supplied bean if it does not meet the requirements for further processing. Closes gh-23435
This commit is contained in:
committed by
Sam Brannen
parent
1925526df5
commit
1dc2177a4a
@@ -77,12 +77,16 @@ class ApplicationContextAwareProcessor implements BeanPostProcessor {
|
||||
@Override
|
||||
@Nullable
|
||||
public Object postProcessBeforeInitialization(final Object bean, String beanName) throws BeansException {
|
||||
|
||||
if (!(bean instanceof EnvironmentAware || bean instanceof EmbeddedValueResolverAware ||
|
||||
bean instanceof ResourceLoaderAware || bean instanceof ApplicationEventPublisherAware ||
|
||||
bean instanceof MessageSourceAware || bean instanceof ApplicationContextAware)){
|
||||
return bean;
|
||||
}
|
||||
|
||||
AccessControlContext acc = null;
|
||||
|
||||
if (System.getSecurityManager() != null &&
|
||||
(bean instanceof EnvironmentAware || bean instanceof EmbeddedValueResolverAware ||
|
||||
bean instanceof ResourceLoaderAware || bean instanceof ApplicationEventPublisherAware ||
|
||||
bean instanceof MessageSourceAware || bean instanceof ApplicationContextAware)) {
|
||||
if (System.getSecurityManager() != null ) {
|
||||
acc = this.applicationContext.getBeanFactory().getAccessControlContext();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user