Package org.springframework.beans.factory

Examples of org.springframework.beans.factory.NoSuchBeanDefinitionException


      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

      else {
        return lookup(name, requiredType);
      }
    }
    catch (NameNotFoundException ex) {
      throw new NoSuchBeanDefinitionException(name, "not found in JNDI environment");
    }
    catch (TypeMismatchNamingException ex) {
      throw new BeanNotOfRequiredTypeException(name, ex.getRequiredType(), ex.getActualType());
    }
    catch (NamingException ex) {
View Full Code Here

  public Class<?> getType(String name) throws NoSuchBeanDefinitionException {
    try {
      return doGetType(name);
    }
    catch (NameNotFoundException ex) {
      throw new NoSuchBeanDefinitionException(name, "not found in JNDI environment");
    }
    catch (NamingException ex) {
      return null;
    }
  }
View Full Code Here

public class StrictBeanMap extends BeanMap {

  public Object getBean(String name) throws BeansException {
    Object object = super.getBean(name);
    if (object == null) {
      throw new NoSuchBeanDefinitionException(name);
    }
    return object;
  }
View Full Code Here

        ((ConfigurableBeanFactory) this.beanFactory).registerDependentBean(unitName, requestingBeanName);
      }
      return (EntityManagerFactory) entry.getValue();
    }
    else {
      throw new NoSuchBeanDefinitionException(
          EntityManagerFactory.class, "expected single bean but found " + matchingBeans.size());
    }
  }
View Full Code Here

    }
    if (this.alwaysUseJndiLookup) {
      return this.jndiFactory.getBean(element.name, element.lookupType);
    }
    if (this.resourceFactory == null) {
      throw new NoSuchBeanDefinitionException(element.lookupType,
          "No resource factory configured - specify the 'resourceFactory' property");
    }
    return autowireResource(this.resourceFactory, element, requestingBeanName);
  }
View Full Code Here

            ((ConfigurableBeanFactory) beanFactory).registerDependentBean(this.beanName, requestingBeanName);
          }
          return bean;
        }
        else if (this.isDefaultName && !StringUtils.hasLength(this.mappedName)) {
          throw new NoSuchBeanDefinitionException(this.beanName,
              "Cannot resolve 'beanName' in local BeanFactory. Consider specifying a general 'name' value instead.");
        }
      }
      // JNDI name lookup - may still go to a local BeanFactory.
      return getResource(this, requestingBeanName);
View Full Code Here

      else {
        return lookup(name, requiredType);
      }
    }
    catch (NameNotFoundException ex) {
      throw new NoSuchBeanDefinitionException(name, "not found in JNDI environment");
    }
    catch (TypeMismatchNamingException ex) {
      throw new BeanNotOfRequiredTypeException(name, ex.getRequiredType(), ex.getActualType());
    }
    catch (NamingException ex) {
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.