Revised NoSuchBeanDefinitionException message and ResolvableType handling
Includes consistent quoting of qualified type names in related classes. Issue: SPR-14831
This commit is contained in:
@@ -82,7 +82,7 @@ public class ContextAnnotationAutowireCandidateResolver extends QualifierAnnotat
|
||||
public Object getTarget() {
|
||||
Object target = beanFactory.doResolveDependency(descriptor, beanName, null, null);
|
||||
if (target == null) {
|
||||
throw new NoSuchBeanDefinitionException(descriptor.getDependencyType(),
|
||||
throw new NoSuchBeanDefinitionException(descriptor.getResolvableType(),
|
||||
"Optional dependency not present for lazy injection point");
|
||||
}
|
||||
return target;
|
||||
|
||||
@@ -48,6 +48,7 @@ class GroovyApplicationContextDynamicBeanPropertyTests {
|
||||
|
||||
def err = shouldFail NoSuchBeanDefinitionException, { ctx.someNonExistentBean }
|
||||
|
||||
assertEquals "No bean named 'someNonExistentBean' is defined", err.message
|
||||
assertEquals "No bean named 'someNonExistentBean' available", err.message
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ public class AnnotationConfigApplicationContextTests {
|
||||
}
|
||||
catch (NoSuchBeanDefinitionException ex) {
|
||||
assertThat(ex.getMessage(), containsString(
|
||||
format("No qualifying bean of type [%s] is defined", targetType.getName())));
|
||||
format("No qualifying bean of type '%s'", targetType.getName())));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ public class AnnotationConfigApplicationContextTests {
|
||||
catch (NoSuchBeanDefinitionException ex) {
|
||||
assertThat(ex.getMessage(),
|
||||
allOf(
|
||||
containsString("No qualifying bean of type [" + TestBean.class.getName() + "] is defined"),
|
||||
containsString("No qualifying bean of type '" + TestBean.class.getName() + "'"),
|
||||
containsString("tb1"),
|
||||
containsString("tb2")
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user