Package org.springframework.beans.factory

Examples of org.springframework.beans.factory.NoSuchBeanDefinitionException


            else {
              if (getParentBeanFactory() instanceof ConfigurableBeanFactory) {
                pbd = ((ConfigurableBeanFactory) getParentBeanFactory()).getMergedBeanDefinition(parentBeanName);
              }
              else {
                throw new NoSuchBeanDefinitionException(bd.getParentName(),
                    "Parent name '" + bd.getParentName() + "' is equal to bean name '" + beanName +
                    "': cannot be resolved without an AbstractBeanFactory parent");
              }
            }
          }
View Full Code Here


    }
    else if (beanNames.length == 0 && getParentBeanFactory() != null) {
      return getParentBeanFactory().getBean(requiredType);
    }
    else {
      throw new NoSuchBeanDefinitionException(requiredType, "expected single bean but found " +
          beanNames.length + ": " + StringUtils.arrayToCommaDelimitedString(beanNames));
    }
  }
View Full Code Here

    BeanDefinition bd = this.beanDefinitionMap.get(beanName);
    if (bd == null) {
      if (this.logger.isTraceEnabled()) {
        this.logger.trace("No bean named '" + beanName + "' found in " + this);
      }
      throw new NoSuchBeanDefinitionException(beanName);
    }
    return bd;
  }
View Full Code Here

      BeanDefinition bd = this.beanDefinitionMap.remove(beanName);
      if (bd == null) {
        if (this.logger.isTraceEnabled()) {
          this.logger.trace("No bean named '" + beanName + "' found in " + this);
        }
        throw new NoSuchBeanDefinitionException(beanName);
      }
      this.beanDefinitionNames.remove(beanName);
      this.frozenBeanDefinitionNames = null;

      resetBeanDefinition(beanName);
View Full Code Here

        return null;
      }
      if (matchingBeans.size() > 1) {
        String primaryBeanName = determinePrimaryCandidate(matchingBeans, descriptor);
        if (primaryBeanName == null) {
          throw new NoSuchBeanDefinitionException(type, "expected single matching bean but found " +
              matchingBeans.size() + ": " + matchingBeans.keySet());
        }
        if (autowiredBeanNames != null) {
          autowiredBeanNames.add(primaryBeanName);
        }
View Full Code Here

      if (isPrimary(candidateBeanName, beanInstance)) {
        if (primaryBeanName != null) {
          boolean candidateLocal = containsBeanDefinition(candidateBeanName);
          boolean primaryLocal = containsBeanDefinition(primaryBeanName);
          if (candidateLocal == primaryLocal) {
            throw new NoSuchBeanDefinitionException(descriptor.getDependencyType(),
                "more than one 'primary' bean found among candidates: " + candidateBeans.keySet());
          }
          else if (candidateLocal && !primaryLocal) {
            primaryBeanName = candidateBeanName;
          }
View Full Code Here

   */
  private void raiseNoSuchBeanDefinitionException(
      Class type, String dependencyDescription, DependencyDescriptor descriptor)
      throws NoSuchBeanDefinitionException {

    throw new NoSuchBeanDefinitionException(type, dependencyDescription,
        "expected at least 1 bean which qualifies as autowire candidate for this dependency. " +
        "Dependency annotations: " + ObjectUtils.nullSafeToString(descriptor.getAnnotations()));
  }
View Full Code Here

            else {
              if (getParentBeanFactory() instanceof ConfigurableBeanFactory) {
                pbd = ((ConfigurableBeanFactory) getParentBeanFactory()).getMergedBeanDefinition(parentBeanName);
              }
              else {
                throw new NoSuchBeanDefinitionException(bd.getParentName(),
                    "Parent name '" + bd.getParentName() + "' is equal to bean name '" + beanName +
                    "': cannot be resolved without an AbstractBeanFactory parent");
              }
            }
          }
View Full Code Here

    this.beanDefinitionMap.put(beanName, beanDefinition);
  }

  public void removeBeanDefinition(String beanName) throws NoSuchBeanDefinitionException {
    if (this.beanDefinitionMap.remove(beanName) == null) {
      throw new NoSuchBeanDefinitionException(beanName);
    }
  }
View Full Code Here

  }

  public BeanDefinition getBeanDefinition(String beanName) throws NoSuchBeanDefinitionException {
    BeanDefinition bd = this.beanDefinitionMap.get(beanName);
    if (bd == null) {
      throw new NoSuchBeanDefinitionException(beanName);
    }
    return bd;
  }
View Full Code Here

TOP

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

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.