Package org.springframework.beans.factory

Examples of org.springframework.beans.factory.BeanDefinitionStoreException


  }

  public Object configureBean(Object existingBean, String beanName) throws BeansException {
    BeanDefinition bd = getMergedBeanDefinition(beanName);
    if (!(bd instanceof RootBeanDefinition)) {
      throw new BeanDefinitionStoreException("configureBean only supported for a merged RootBeanDefinition");
    }
    RootBeanDefinition rbd = (RootBeanDefinition) bd;
    BeanWrapper bw = new BeanWrapperImpl(existingBean);
    initBeanWrapper(bw);
    populateBean(beanName, rbd, bw);
View Full Code Here


        // Prepare method overrides.
        try {
          mbd.prepareMethodOverrides();
        }
        catch (BeanDefinitionValidationException ex) {
          throw new BeanDefinitionStoreException(mbd.getResourceDescription(),
              beanName, "Validation of method overrides failed", ex);
        }

        try {
          // Give BeanPostProcessors a chance to return a proxy instead of the target bean instance.
View Full Code Here

                               ParserContext ctx)
        throws BeanDefinitionStoreException {
        String id = super.resolveId(elem, definition, ctx);       
       
        if (StringUtils.isEmpty(id)) {
            throw new BeanDefinitionStoreException("The bean id is needed.");
        }      
        return id;
    }
View Full Code Here

                BeanDefinition bd = beanFactory.getBeanDefinition(beanNames[i]);
                try {
                    visitor.visitBeanDefinition(bd);
                }
                catch (BeanDefinitionStoreException ex) {
                    throw new BeanDefinitionStoreException(bd.getResourceDescription(), beanNames[i], ex.getMessage());
                }
            }
        }
    }  
View Full Code Here

            "Group resource name [" + this.resourceLocation + "], factory key [" + factoryKey + "]");
      }
      reader.loadBeanDefinitions(configResources);
    }
    catch (IOException ex) {
      throw new BeanDefinitionStoreException(
          "Error accessing bean definition resource [" + this.resourceLocation + "]", ex);
    }
    catch (BeanDefinitionStoreException ex) {
      throw new FatalBeanException("Unable to load group definition: " +
          "group resource name [" + this.resourceLocation + "], factory key [" + factoryKey + "]", ex);
View Full Code Here

    // Prepare method overrides.
    try {
      mbd.prepareMethodOverrides();
    }
    catch (BeanDefinitionValidationException ex) {
      throw new BeanDefinitionStoreException(mbd.getResourceDescription(),
          beanName, "Validation of method overrides failed", ex);
    }

    try {
      // Give BeanPostProcessors a chance to return a proxy instead of the target bean instance.
View Full Code Here

    boolean isStatic = true;

    String factoryBeanName = mbd.getFactoryBeanName();
    if (factoryBeanName != null) {
      if (factoryBeanName.equals(beanName)) {
        throw new BeanDefinitionStoreException(mbd.getResourceDescription(), beanName,
            "factory-bean reference points back to the same bean definition");
      }
      // Check declared factory method return type on factory class.
      factoryClass = getType(factoryBeanName);
      isStatic = false;
View Full Code Here

    }
    else if (value instanceof RuntimeBeanNameReference) {
      String refName = ((RuntimeBeanNameReference) value).getBeanName();
      refName = String.valueOf(evaluate(refName));
      if (!this.beanFactory.containsBean(refName)) {
        throw new BeanDefinitionStoreException(
            "Invalid bean name '" + refName + "' in bean reference for " + argName);
      }
      return refName;
    }
    else if (value instanceof BeanDefinitionHolder) {
View Full Code Here

    boolean isStatic;

    String factoryBeanName = mbd.getFactoryBeanName();
    if (factoryBeanName != null) {
      if (factoryBeanName.equals(beanName)) {
        throw new BeanDefinitionStoreException(mbd.getResourceDescription(), beanName,
            "factory-bean reference points back to the same bean definition");
      }
      factoryBean = this.beanFactory.getBean(factoryBeanName);
      if (factoryBean == null) {
        throw new BeanCreationException(mbd.getResourceDescription(), beanName,
            "factory-bean '" + factoryBeanName + "' returned null");
      }
      factoryClass = factoryBean.getClass();
      isStatic = false;
    }
    else {
      // It's a static factory method on the bean class.
      if (!mbd.hasBeanClass()) {
        throw new BeanDefinitionStoreException(mbd.getResourceDescription(), beanName,
            "bean definition declares neither a bean class nor a factory-bean reference");
      }
      factoryBean = null;
      factoryClass = mbd.getBeanClass();
      isStatic = true;
View Full Code Here

        BeanDefinition bd = beanFactoryToProcess.getBeanDefinition(curName);
        try {
          visitor.visitBeanDefinition(bd);
        }
        catch (Exception ex) {
          throw new BeanDefinitionStoreException(bd.getResourceDescription(), curName, ex.getMessage());
        }
      }
    }

    // New in Spring 2.5: resolve placeholders in alias target names and aliases as well.
View Full Code Here

TOP

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

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.