Prepare method overrides when bean class gets resolved
See gh-31826
See gh-31828
(cherry picked from commit cd64e6676c
)
This commit is contained in:
parent
db52c77cca
commit
76bc9cf325
|
@ -493,15 +493,13 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||||
if (resolvedClass != null && !mbd.hasBeanClass() && mbd.getBeanClassName() != null) {
|
if (resolvedClass != null && !mbd.hasBeanClass() && mbd.getBeanClassName() != null) {
|
||||||
mbdToUse = new RootBeanDefinition(mbd);
|
mbdToUse = new RootBeanDefinition(mbd);
|
||||||
mbdToUse.setBeanClass(resolvedClass);
|
mbdToUse.setBeanClass(resolvedClass);
|
||||||
}
|
try {
|
||||||
|
mbdToUse.prepareMethodOverrides();
|
||||||
// Prepare method overrides.
|
}
|
||||||
try {
|
catch (BeanDefinitionValidationException ex) {
|
||||||
mbdToUse.prepareMethodOverrides();
|
throw new BeanDefinitionStoreException(mbdToUse.getResourceDescription(),
|
||||||
}
|
beanName, "Validation of method overrides failed", ex);
|
||||||
catch (BeanDefinitionValidationException ex) {
|
}
|
||||||
throw new BeanDefinitionStoreException(mbdToUse.getResourceDescription(),
|
|
||||||
beanName, "Validation of method overrides failed", ex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -1497,7 +1497,11 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||||
if (mbd.hasBeanClass()) {
|
if (mbd.hasBeanClass()) {
|
||||||
return mbd.getBeanClass();
|
return mbd.getBeanClass();
|
||||||
}
|
}
|
||||||
return doResolveBeanClass(mbd, typesToMatch);
|
Class<?> beanClass = doResolveBeanClass(mbd, typesToMatch);
|
||||||
|
if (mbd.hasBeanClass()) {
|
||||||
|
mbd.prepareMethodOverrides();
|
||||||
|
}
|
||||||
|
return beanClass;
|
||||||
}
|
}
|
||||||
catch (ClassNotFoundException ex) {
|
catch (ClassNotFoundException ex) {
|
||||||
throw new CannotLoadBeanClassException(mbd.getResourceDescription(), beanName, mbd.getBeanClassName(), ex);
|
throw new CannotLoadBeanClassException(mbd.getResourceDescription(), beanName, mbd.getBeanClassName(), ex);
|
||||||
|
@ -1505,6 +1509,10 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||||
catch (LinkageError err) {
|
catch (LinkageError err) {
|
||||||
throw new CannotLoadBeanClassException(mbd.getResourceDescription(), beanName, mbd.getBeanClassName(), err);
|
throw new CannotLoadBeanClassException(mbd.getResourceDescription(), beanName, mbd.getBeanClassName(), err);
|
||||||
}
|
}
|
||||||
|
catch (BeanDefinitionValidationException ex) {
|
||||||
|
throw new BeanDefinitionStoreException(mbd.getResourceDescription(),
|
||||||
|
beanName, "Validation of method overrides failed", ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|
Loading…
Reference in New Issue