Package org.springframework.beans.factory

Examples of org.springframework.beans.factory.BeanDefinitionStoreException


            // now lets parse the routes with JAXB
            Binder<Node> binder;
            try {
                binder = getJaxbContext().createBinder();
            } catch (JAXBException e) {
                throw new BeanDefinitionStoreException("Failed to create the JAXB binder", e);
            }
            Object value = parseUsingJaxb(element, parserContext, binder);
           
            if (value instanceof CamelContextFactoryBean) {
                // set the property value with the JAXB parsed value
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

  }

  public int loadBeanDefinitions(String location) throws BeanDefinitionStoreException {
    ResourceLoader resourceLoader = getResourceLoader();
    if (resourceLoader == null) {
      throw new BeanDefinitionStoreException(
          "Cannot import bean definitions from location [" + location + "]: no ResourceLoader available");
    }

    if (resourceLoader instanceof ResourcePatternResolver) {
      // Resource pattern matching available.
      try {
        Resource[] resources = ((ResourcePatternResolver) resourceLoader).getResources(location);
        int loadCount = loadBeanDefinitions(resources);
        if (logger.isDebugEnabled()) {
          logger.debug("Loaded " + loadCount + " bean definitions from location pattern [" + location + "]");
        }
        return loadCount;
      }
      catch (IOException ex) {
        throw new BeanDefinitionStoreException(
            "Could not resolve bean definition resource pattern [" + location + "]", ex);
      }
    }
    else {
      // Can only load single resources by absolute URL.
View Full Code Here

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

    if (beanDefinition instanceof AbstractBeanDefinition) {
      try {
        ((AbstractBeanDefinition) beanDefinition).validate();
      }
      catch (BeanDefinitionValidationException ex) {
        throw new BeanDefinitionStoreException(beanDefinition.getResourceDescription(), beanName,
            "Validation of bean definition failed", ex);
      }
    }

    synchronized (this.beanDefinitionMap) {
      Object oldBeanDefinition = this.beanDefinitionMap.get(beanName);
      if (oldBeanDefinition != null) {
        if (!this.allowBeanDefinitionOverriding) {
          throw new BeanDefinitionStoreException(beanDefinition.getResourceDescription(), beanName,
              "Cannot register bean definition [" + beanDefinition + "] for bean '" + beanName +
              "': There is already [" + oldBeanDefinition + "] bound.");
        }
        else {
          if (this.logger.isInfoEnabled()) {
View Full Code Here

        is.close();
      }
      return registerBeanDefinitions(props, prefix, encodedResource.getResource().getDescription());
    }
    catch (IOException ex) {
      throw new BeanDefinitionStoreException("Could not parse properties from " + encodedResource.getResource(), ex);
    }
  }
View Full Code Here

        logger.debug("Registering alias '" + alias + "' for bean with name '" + beanName + "'");
      }
      synchronized (this.aliasMap) {
        String registeredName = (String) this.aliasMap.get(alias);
        if (registeredName != null && !registeredName.equals(beanName)) {
          throw new BeanDefinitionStoreException("Cannot register alias '" + alias + "' for bean name '" +
              beanName + "': It is already registered for bean name '" + registeredName + "'.");
        }
        this.aliasMap.put(alias, beanName);
      }
    }
View Full Code Here

        String resolvedAlias = valueResolver.resolveStringValue(alias);
        String resolvedName = valueResolver.resolveStringValue(registeredName);
        if (!resolvedAlias.equals(alias)) {
          String existingName = (String) this.aliasMap.get(resolvedAlias);
          if (existingName != null && !existingName.equals(resolvedName)) {
            throw new BeanDefinitionStoreException("Cannot register resolved alias '" +
                resolvedAlias + "' (original: '" + alias + "') for bean name '" + resolvedName +
                "': It is already registered for bean name '" + registeredName + "'.");
          }
          this.aliasMap.put(resolvedAlias, resolvedName);
          this.aliasMap.remove(alias);
View Full Code Here

                    "': cannot be resolved without an AbstractBeanFactory parent");
              }
            }
          }
          catch (NoSuchBeanDefinitionException ex) {
            throw new BeanDefinitionStoreException(bd.getResourceDescription(), beanName,
                "Could not resolve parent bean definition '" + bd.getParentName() + "'", ex);
          }
          // Deep copy with overridden values.
          mbd = new RootBeanDefinition(pbd);
          mbd.overrideFrom(bd);
View Full Code Here

    }

    // Check validity of the usage of the args parameter. This can
    // only be used for prototypes constructed via a factory method.
    if (args != null && !mbd.isPrototype()) {
      throw new BeanDefinitionStoreException(
          "Can only specify arguments for the getBean method when referring to a prototype bean definition");
    }
  }
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.