Merge branch '3.2.x'

Closes gh-40855
This commit is contained in:
Andy Wilkinson
2024-05-21 15:48:15 +01:00
2 changed files with 95 additions and 3 deletions

View File

@@ -254,9 +254,8 @@ public class MockitoPostProcessor implements InstantiationAwareBeanPostProcessor
Class<?> type = resolvableType.resolve(Object.class);
for (String beanName : beanFactory.getBeanNamesForType(FactoryBean.class, true, false)) {
beanName = BeanFactoryUtils.transformedBeanName(beanName);
BeanDefinition beanDefinition = beanFactory.getBeanDefinition(beanName);
Object attribute = beanDefinition.getAttribute(FactoryBean.OBJECT_TYPE_ATTRIBUTE);
if (resolvableType.equals(attribute) || type.equals(attribute)) {
Class<?> producedType = beanFactory.getType(beanName, false);
if (type.equals(producedType)) {
beans.add(beanName);
}
}