Package org.springframework.beans.factory

Examples of org.springframework.beans.factory.BeanDefinitionStoreException


    if (attributeValue instanceof Boolean) {
      proxyTargetClass = ((Boolean) attributeValue).booleanValue();
    } else if (attributeValue instanceof String) {
      proxyTargetClass = new Boolean((String) attributeValue);
    } else if (attributeValue != null) {
      throw new BeanDefinitionStoreException("Invalid refresh check delay attribute ["
          + REFRESH_CHECK_DELAY_ATTRIBUTE + "] with value [" + attributeValue
          + "]: needs to be of type Number or String");
    }
    return proxyTargetClass;
  }
View Full Code Here


      finally {
        inputStream.close();
      }
    }
    catch (IOException ex) {
      throw new BeanDefinitionStoreException(
          "IOException parsing XML document from " + encodedResource.getResource(), ex);
    }
  }
View Full Code Here

    catch (SAXException ex) {
      throw new XmlBeanDefinitionStoreException(resource.getDescription(),
          "XML document from " + resource + " is invalid", ex);
    }
    catch (ParserConfigurationException ex) {
      throw new BeanDefinitionStoreException(resource.getDescription(),
          "Parser configuration exception parsing XML from " + resource, ex);
    }
    catch (IOException ex) {
      throw new BeanDefinitionStoreException(resource.getDescription(),
          "IOException parsing XML document from " + resource, ex);
    }
    catch (Throwable ex) {
      throw new BeanDefinitionStoreException(resource.getDescription(),
          "Unexpected exception parsing XML document from " + resource, ex);
    }
  }
View Full Code Here

   * file has a <code>DOCTYPE</code> definition then DTD validation is used
   * otherwise XSD validation is assumed.
   */
  protected int detectValidationMode(Resource resource) {
    if (resource.isOpen()) {
      throw new BeanDefinitionStoreException(
          "Passed-in Resource [" + resource + "] contains an open stream: " +
          "cannot determine validation mode automatically. Either pass in a Resource " +
          "that is able to create fresh streams, or explicitly specify the validationMode " +
          "on your XmlBeanDefinitionReader instance.");
    }

    InputStream inputStream;
    try {
      inputStream = resource.getInputStream();
    }
    catch (IOException ex) {
      throw new BeanDefinitionStoreException(
          "Unable to determine validation mode for [" + resource + "]: cannot open InputStream. " +
          "Did you attempt to load directly from a SAX InputSource without specifying the " +
          "validationMode on your XmlBeanDefinitionReader instance?", ex);
    }

    try {
      return this.validationModeDetector.detectValidationMode(inputStream);
    }
    catch (IOException ex) {
      throw new BeanDefinitionStoreException("Unable to determine validation mode for [" +
          resource + "]: an error occurred whilst reading from the InputStream.", ex);
    }
  }
View Full Code Here

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

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

      int endIndex = buf.indexOf(
          this.placeholderSuffix, startIndex + this.placeholderPrefix.length());
      if (endIndex != -1) {
        String placeholder = buf.substring(startIndex + this.placeholderPrefix.length(), endIndex);
        if (!visitedPlaceholders.add(placeholder)) {
          throw new BeanDefinitionStoreException(
              "Circular placeholder reference '" + placeholder + "' in property definitions");
        }
        String propVal = resolvePlaceholder(placeholder, props, this.systemPropertiesMode);
        if (propVal != null) {
          // Recursive invocation, parsing placeholders contained in the
          // previously resolved placeholder value.
          propVal = parseStringValue(propVal, props, visitedPlaceholders);
          buf.replace(startIndex, endIndex + this.placeholderSuffix.length(), propVal);
          if (logger.isTraceEnabled()) {
            logger.trace("Resolved placeholder '" + placeholder + "'");
          }
          startIndex = buf.indexOf(this.placeholderPrefix, startIndex + propVal.length());
        }
        else if (this.ignoreUnresolvablePlaceholders) {
          // Proceed with unprocessed value.
          startIndex = buf.indexOf(this.placeholderPrefix, endIndex + this.placeholderSuffix.length());
        }
        else {
          throw new BeanDefinitionStoreException("Could not resolve placeholder '" + placeholder + "'");
        }
        visitedPlaceholders.remove(placeholder);
      }
      else {
        startIndex = -1;
View Full Code Here

          }
        }
      }
    }
    catch (IOException ex) {
      throw new BeanDefinitionStoreException("I/O failure during classpath scanning", ex);
    }
    return candidates;
  }
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

      else if (definition.getFactoryBeanName() != null) {
        generatedBeanName = definition.getFactoryBeanName() + "$created";
      }
    }
    if (!StringUtils.hasText(generatedBeanName)) {
      throw new BeanDefinitionStoreException("Unnamed bean definition specifies neither " +
          "'class' nor 'parent' nor 'factory-bean' - can't generate bean name");
    }

    String id = generatedBeanName;
    if (isInnerBean) {
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.