Examples of UnsatisfiedDependencyException


Examples of org.springframework.beans.factory.UnsatisfiedDependencyException

        boolean isSimple = BeanUtils.isSimpleProperty(pd.getPropertyType());
        boolean unsatisfied = (dependencyCheck == RootBeanDefinition.DEPENDENCY_CHECK_ALL) ||
            (isSimple && dependencyCheck == RootBeanDefinition.DEPENDENCY_CHECK_SIMPLE) ||
            (!isSimple && dependencyCheck == RootBeanDefinition.DEPENDENCY_CHECK_OBJECTS);
        if (unsatisfied) {
          throw new UnsatisfiedDependencyException(mbd.getResourceDescription(), beanName, pd.getName(),
              "Set this property value or disable dependency checking for this bean.");
        }
      }
    }
  }
View Full Code Here

Examples of org.springframework.beans.factory.UnsatisfiedDependencyException

              resolveNecessary = true;
              args.preparedArguments[paramIndex] = sourceValue;
            }
          }
          catch (TypeMismatchException ex) {
            throw new UnsatisfiedDependencyException(
                mbd.getResourceDescription(), beanName, paramIndex, paramType,
                "Could not convert " + methodType + " argument value of type [" +
                ObjectUtils.nullSafeClassName(valueHolder.getValue()) +
                "] to required type [" + paramType.getName() + "]: " + ex.getMessage());
          }
        }
      }
      else {
        // No explicit match found: we're either supposed to autowire or
        // have to fail creating an argument array for the given constructor.
        if (!autowiring) {
          throw new UnsatisfiedDependencyException(
              mbd.getResourceDescription(), beanName, paramIndex, paramType,
              "Ambiguous " + methodType + " argument types - " +
              "did you specify the correct bean references as " + methodType + " arguments?");
        }
        try {
          MethodParameter param = MethodParameter.forMethodOrConstructor(methodOrCtor, paramIndex);
          Object autowiredArgument = resolveAutowiredArgument(param, beanName, autowiredBeanNames, converter);
          args.rawArguments[paramIndex] = autowiredArgument;
          args.arguments[paramIndex] = autowiredArgument;
          args.preparedArguments[paramIndex] = new AutowiredArgumentMarker();
          resolveNecessary = true;
        }
        catch (BeansException ex) {
          throw new UnsatisfiedDependencyException(
              mbd.getResourceDescription(), beanName, paramIndex, paramType, ex.getMessage());
        }
      }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.