Restore restrictive getTypeForFactoryBeanFromAttributes check

See gh-29799
See gh-30987
This commit is contained in:
Juergen Hoeller 2023-08-04 00:56:01 +02:00
parent f7c3e6480a
commit a6ff95a69c
1 changed files with 5 additions and 1 deletions

View File

@ -73,13 +73,17 @@ public abstract class FactoryBeanRegistrySupport extends DefaultSingletonBeanReg
*/
ResolvableType getTypeForFactoryBeanFromAttributes(AttributeAccessor attributes) {
Object attribute = attributes.getAttribute(FactoryBean.OBJECT_TYPE_ATTRIBUTE);
if (attribute == null) {
return ResolvableType.NONE;
}
if (attribute instanceof ResolvableType resolvableType) {
return resolvableType;
}
if (attribute instanceof Class<?> clazz) {
return ResolvableType.forClass(clazz);
}
return ResolvableType.NONE;
throw new IllegalArgumentException("Invalid value type for attribute '" +
FactoryBean.OBJECT_TYPE_ATTRIBUTE + "': " + attribute.getClass().getName());
}
/**