Expose ResolvableType in NoSuchBeanDefinitionException
This commit improves NoSuchBeanDefinitionException to expose a full
ResolvableType rather than a raw class if a lookup by type failed. This
allows to know more about the underlying type and is typically useful
when a collection or map is required as the relevant generic type is the
actual bean that wasn't found.
Issue: SPR-14831
@ -38,7 +40,7 @@ public class NoSuchBeanDefinitionException extends BeansException {
@@ -38,7 +40,7 @@ public class NoSuchBeanDefinitionException extends BeansException {
privateStringbeanName;
/** Required type of the missing bean */
privateClass<?>beanType;
privateResolvableTypebeanResolvableType;
/**
@ -66,7 +68,7 @@ public class NoSuchBeanDefinitionException extends BeansException {
@@ -66,7 +68,7 @@ public class NoSuchBeanDefinitionException extends BeansException {
@ -76,7 +78,7 @@ public class NoSuchBeanDefinitionException extends BeansException {
@@ -76,7 +78,7 @@ public class NoSuchBeanDefinitionException extends BeansException {
@ -84,13 +86,34 @@ public class NoSuchBeanDefinitionException extends BeansException {
@@ -84,13 +86,34 @@ public class NoSuchBeanDefinitionException extends BeansException {
" of type ["+ClassUtils.getQualifiedName(resolvableType.getRawClass())+"]":"")+
" found for dependency"+(StringUtils.hasLength(dependencyDescription)?" ["+
dependencyDescription+"]":"")+": "+message);
this.beanResolvableType=resolvableType;
}
@ -101,11 +124,19 @@ public class NoSuchBeanDefinitionException extends BeansException {
@@ -101,11 +124,19 @@ public class NoSuchBeanDefinitionException extends BeansException {
@ -1081,7 +1081,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
@@ -1081,7 +1081,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
@ -1444,11 +1444,11 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
@@ -1444,11 +1444,11 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto