01: /*
02: * Copyright 2002-2006 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16:
17: package org.springframework.beans.factory;
18:
19: import org.springframework.util.ClassUtils;
20:
21: /**
22: * Exception thrown when a bean depends on other beans or simple properties
23: * that were not specified in the bean factory definition, although
24: * dependency checking was enabled.
25: *
26: * @author Rod Johnson
27: * @author Juergen Hoeller
28: * @since 03.09.2003
29: */
30: public class UnsatisfiedDependencyException extends
31: BeanCreationException {
32:
33: /**
34: * Create a new UnsatisfiedDependencyException.
35: * @param resourceDescription description of the resource
36: * that the bean definition came from
37: * @param beanName the name of the bean requested
38: * @param propertyName the name of the bean property that
39: * couldn't be satisfied
40: * @param msg the detail message
41: */
42: public UnsatisfiedDependencyException(String resourceDescription,
43: String beanName, String propertyName, String msg) {
44:
45: super (resourceDescription, beanName,
46: "Unsatisfied dependency expressed through bean property '"
47: + propertyName + "'"
48: + (msg != null ? ": " + msg : ""));
49: }
50:
51: /**
52: * Create a new UnsatisfiedDependencyException.
53: * @param resourceDescription description of the resource
54: * that the bean definition came from
55: * @param beanName the name of the bean requested
56: * @param ctorArgIndex the index of the constructor argument
57: * that couldn't be satisfied
58: * @param ctorArgType the type of the constructor argument
59: * that couldn't be satisfied
60: * @param msg the detail message
61: */
62: public UnsatisfiedDependencyException(String resourceDescription,
63: String beanName, int ctorArgIndex, Class ctorArgType,
64: String msg) {
65:
66: super (resourceDescription, beanName,
67: "Unsatisfied dependency expressed through constructor argument with index "
68: + ctorArgIndex + " of type ["
69: + ClassUtils.getQualifiedName(ctorArgType)
70: + "]" + (msg != null ? ": " + msg : ""));
71: }
72:
73: }
|