Skip to content

Commit 775a23b

Browse files
committed
Merge branch '6.1.x'
2 parents acb427d + 61adf2d commit 775a23b

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java

+11-3
Original file line numberDiff line numberDiff line change
@@ -844,10 +844,18 @@ protected Class<?> getTypeForFactoryMethod(String beanName, RootBeanDefinition m
844844
*/
845845
@Override
846846
protected ResolvableType getTypeForFactoryBean(String beanName, RootBeanDefinition mbd, boolean allowInit) {
847+
ResolvableType result;
848+
847849
// Check if the bean definition itself has defined the type with an attribute
848-
ResolvableType result = getTypeForFactoryBeanFromAttributes(mbd);
849-
if (result != ResolvableType.NONE) {
850-
return result;
850+
try {
851+
result = getTypeForFactoryBeanFromAttributes(mbd);
852+
if (result != ResolvableType.NONE) {
853+
return result;
854+
}
855+
}
856+
catch (IllegalArgumentException ex) {
857+
throw new BeanDefinitionStoreException(mbd.getResourceDescription(), beanName,
858+
String.valueOf(ex.getMessage()));
851859
}
852860

853861
// For instance supplied beans, try the target type and bean class immediately

spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java

+9-3
Original file line numberDiff line numberDiff line change
@@ -1712,9 +1712,15 @@ protected boolean isFactoryBean(String beanName, RootBeanDefinition mbd) {
17121712
* @see #getBean(String)
17131713
*/
17141714
protected ResolvableType getTypeForFactoryBean(String beanName, RootBeanDefinition mbd, boolean allowInit) {
1715-
ResolvableType result = getTypeForFactoryBeanFromAttributes(mbd);
1716-
if (result != ResolvableType.NONE) {
1717-
return result;
1715+
try {
1716+
ResolvableType result = getTypeForFactoryBeanFromAttributes(mbd);
1717+
if (result != ResolvableType.NONE) {
1718+
return result;
1719+
}
1720+
}
1721+
catch (IllegalArgumentException ex) {
1722+
throw new BeanDefinitionStoreException(mbd.getResourceDescription(), beanName,
1723+
String.valueOf(ex.getMessage()));
17181724
}
17191725

17201726
if (allowInit && mbd.isSingleton()) {

0 commit comments

Comments
 (0)