1
1
/*
2
- * Copyright 2002-2009 the original author or authors.
2
+ * Copyright 2002-2012 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
20
20
import org .springframework .util .StringUtils ;
21
21
22
22
/**
23
- * Exception thrown when a BeanFactory is asked for a bean
24
- * instance name for which it cannot find a definition.
23
+ * Exception thrown when a {@code BeanFactory} is asked for a bean
24
+ * instance for which it cannot find a definition.
25
25
*
26
26
* @author Rod Johnson
27
27
* @author Juergen Hoeller
28
28
*/
29
+ @ SuppressWarnings ("serial" )
29
30
public class NoSuchBeanDefinitionException extends BeansException {
30
31
31
- /** Name of the missing bean */
32
+ /** Name of the missing bean. */
32
33
private String beanName ;
33
34
34
- /** Required bean type */
35
- private Class beanType ;
35
+ /** Required type of the missing bean. */
36
+ private Class <?> beanType ;
36
37
37
38
38
39
/**
39
- * Create a new NoSuchBeanDefinitionException.
40
+ * Create a new {@code NoSuchBeanDefinitionException} .
40
41
* @param name the name of the missing bean
41
42
*/
42
43
public NoSuchBeanDefinitionException (String name ) {
@@ -45,7 +46,7 @@ public NoSuchBeanDefinitionException(String name) {
45
46
}
46
47
47
48
/**
48
- * Create a new NoSuchBeanDefinitionException.
49
+ * Create a new {@code NoSuchBeanDefinitionException} .
49
50
* @param name the name of the missing bean
50
51
* @param message detailed message describing the problem
51
52
*/
@@ -55,31 +56,31 @@ public NoSuchBeanDefinitionException(String name, String message) {
55
56
}
56
57
57
58
/**
58
- * Create a new NoSuchBeanDefinitionException.
59
- * @param type required type of bean
59
+ * Create a new {@code NoSuchBeanDefinitionException} .
60
+ * @param type required type of the missing bean
60
61
*/
61
- public NoSuchBeanDefinitionException (Class type ) {
62
+ public NoSuchBeanDefinitionException (Class <?> type ) {
62
63
super ("No unique bean of type [" + type .getName () + "] is defined" );
63
64
this .beanType = type ;
64
65
}
65
66
66
67
/**
67
- * Create a new NoSuchBeanDefinitionException.
68
- * @param type required type of bean
68
+ * Create a new {@code NoSuchBeanDefinitionException} .
69
+ * @param type required type of the missing bean
69
70
* @param message detailed message describing the problem
70
71
*/
71
- public NoSuchBeanDefinitionException (Class type , String message ) {
72
+ public NoSuchBeanDefinitionException (Class <?> type , String message ) {
72
73
super ("No unique bean of type [" + type .getName () + "] is defined: " + message );
73
74
this .beanType = type ;
74
75
}
75
76
76
77
/**
77
- * Create a new NoSuchBeanDefinitionException.
78
- * @param type required type of bean
78
+ * Create a new {@code NoSuchBeanDefinitionException} .
79
+ * @param type required type of the missing bean
79
80
* @param dependencyDescription a description of the originating dependency
80
81
* @param message detailed message describing the problem
81
82
*/
82
- public NoSuchBeanDefinitionException (Class type , String dependencyDescription , String message ) {
83
+ public NoSuchBeanDefinitionException (Class <?> type , String dependencyDescription , String message ) {
83
84
super ("No matching bean of type [" + type .getName () + "] found for dependency" +
84
85
(StringUtils .hasLength (dependencyDescription ) ? " [" + dependencyDescription + "]" : "" ) +
85
86
": " + message );
@@ -88,18 +89,18 @@ public NoSuchBeanDefinitionException(Class type, String dependencyDescription, S
88
89
89
90
90
91
/**
91
- * Return the name of the missing bean,
92
- * if it was a lookup by name that failed.
92
+ * Return the name of the missing bean, if it was a lookup <em>by name</em>
93
+ * that failed.
93
94
*/
94
95
public String getBeanName () {
95
96
return this .beanName ;
96
97
}
97
98
98
99
/**
99
- * Return the required type of bean,
100
- * if it was a lookup by type that failed.
100
+ * Return the required type of the missing bean, if it was a lookup
101
+ * <em> by type</em> that failed.
101
102
*/
102
- public Class getBeanType () {
103
+ public Class <?> getBeanType () {
103
104
return this .beanType ;
104
105
}
105
106
0 commit comments