Package org.springframework.beans.factory

Examples of org.springframework.beans.factory.UnsatisfiedDependencyException


          }
        }
        autowiredBeanNames.clear();
      }
      catch (BeansException ex) {
        throw new UnsatisfiedDependencyException(
            mbd.getResourceDescription(), beanName, propertyName, ex.getMessage());
      }
    }
  }
View Full Code Here


        boolean isSimple = BeanUtils.isSimpleProperty(pds[i].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, pds[i].getName(),
              "Set this property value or disable dependency checking for this bean.");
        }
      }
    }
View Full Code Here

              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

          }
          autowiredBeanNames.clear();
        }
      }
      catch (BeansException ex) {
        throw new UnsatisfiedDependencyException(mbd.getResourceDescription(), beanName, propertyName, ex);
      }
    }
  }
View Full Code Here

        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

              args.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());
          }
        }
        args.arguments[paramIndex] = convertedValue;
        args.rawArguments[paramIndex] = originalValue;
      }
      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();
          args.resolveNecessary = true;
        }
        catch (BeansException ex) {
          throw new UnsatisfiedDependencyException(
              mbd.getResourceDescription(), beanName, paramIndex, paramType, ex);
        }
      }
    }
View Full Code Here

      try {
        resolvedArgs[argIndex] = converter.convertIfNecessary(argValue, paramType, methodParam);
      }
      catch (TypeMismatchException ex) {
        String methodType = (methodOrCtor instanceof Constructor ? "constructor" : "factory method");
        throw new UnsatisfiedDependencyException(
            mbd.getResourceDescription(), beanName, argIndex, paramType,
            "Could not convert " + methodType + " argument value of type [" +
            ObjectUtils.nullSafeClassName(argValue) +
            "] to required type [" + paramType.getName() + "]: " + ex.getMessage());
      }
View Full Code Here

          }
          autowiredBeanNames.clear();
        }
      }
      catch (BeansException ex) {
        throw new UnsatisfiedDependencyException(mbd.getResourceDescription(), beanName, propertyName, ex);
      }
    }
  }
View Full Code Here

        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

              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());
          }
        }
        args.arguments[paramIndex] = convertedValue;
        args.rawArguments[paramIndex] = originalValue;
      }
      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);
        }
      }
    }
View Full Code Here

TOP

Related Classes of org.springframework.beans.factory.UnsatisfiedDependencyException

Copyright © 2018 www.massapicom. 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.