@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
/ *
* Copyright 2002 - 2014 the original author or authors .
* Copyright 2002 - 2015 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 .
@ -443,37 +443,43 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
@@ -443,37 +443,43 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
* @see # doCreateBean
* /
@Override
protected Object createBean ( final String beanName , final RootBeanDefinition mbd , final Object [ ] args )
throws BeanCreationException {
protected Object createBean ( String beanName , RootBeanDefinition mbd , Object [ ] args ) throws BeanCreationException {
if ( logger . isDebugEnabled ( ) ) {
logger . debug ( "Creating instance of bean '" + beanName + "'" ) ;
}
// Make sure bean class is actually resolved at this point.
resolveBeanClass ( mbd , beanName ) ;
RootBeanDefinition mbdToUse = mbd ;
// Make sure bean class is actually resolved at this point, and
// clone the bean definition in case of a dynamically resolved Class
// which cannot be stored in the shared merged bean definition.
Class < ? > resolvedClass = resolveBeanClass ( mbd , beanName ) ;
if ( resolvedClass ! = null & & ! mbd . hasBeanClass ( ) & & mbd . getBeanClassName ( ) ! = null ) {
mbdToUse = new RootBeanDefinition ( mbd ) ;
mbdToUse . setBeanClass ( resolvedClass ) ;
}
// Prepare method overrides.
try {
mbd . prepareMethodOverrides ( ) ;
mbdToUse . prepareMethodOverrides ( ) ;
}
catch ( BeanDefinitionValidationException ex ) {
throw new BeanDefinitionStoreException ( mbd . getResourceDescription ( ) ,
throw new BeanDefinitionStoreException ( mbdToUse . getResourceDescription ( ) ,
beanName , "Validation of method overrides failed" , ex ) ;
}
try {
// Give BeanPostProcessors a chance to return a proxy instead of the target bean instance.
Object bean = resolveBeforeInstantiation ( beanName , mbd ) ;
Object bean = resolveBeforeInstantiation ( beanName , mbdToUse ) ;
if ( bean ! = null ) {
return bean ;
}
}
catch ( Throwable ex ) {
throw new BeanCreationException ( mbd . getResourceDescription ( ) , beanName ,
throw new BeanCreationException ( mbdToUse . getResourceDescription ( ) , beanName ,
"BeanPostProcessor before instantiation of bean failed" , ex ) ;
}
Object beanInstance = doCreateBean ( beanName , mbd , args ) ;
Object beanInstance = doCreateBean ( beanName , mbdToUse , args ) ;
if ( logger . isDebugEnabled ( ) ) {
logger . debug ( "Finished creating instance of bean '" + beanName + "'" ) ;
}
@ -833,8 +839,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
@@ -833,8 +839,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
/ * *
* Obtain a "shortcut" singleton FactoryBean instance to use for a
* { @code getObjectType ( ) } call , without full initialization
* of the FactoryBean .
* { @code getObjectType ( ) } call , without full initialization of the FactoryBean .
* @param beanName the name of the bean
* @param mbd the bean definition for the bean
* @return the FactoryBean instance , or { @code null } to indicate
@ -875,8 +880,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
@@ -875,8 +880,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
/ * *
* Obtain a "shortcut" non - singleton FactoryBean instance to use for a
* { @code getObjectType ( ) } call , without full initialization
* of the FactoryBean .
* { @code getObjectType ( ) } call , without full initialization of the FactoryBean .
* @param beanName the name of the bean
* @param mbd the bean definition for the bean
* @return the FactoryBean instance , or { @code null } to indicate