Codota Logo
DefaultXmlBeanDefinitionParser
Code IndexAdd Codota to your IDE (free)

How to use
DefaultXmlBeanDefinitionParser
in
org.springframework.beans.factory.xml

Best Java code snippets using org.springframework.beans.factory.xml.DefaultXmlBeanDefinitionParser (Showing top 19 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Charset c =
  • Codota IconString charsetName;Charset.forName(charsetName)
  • Codota IconCharset.defaultCharset()
  • Codota IconContentType contentType;contentType.getCharset()
  • Smart code suggestions by Codota
}
origin: org.objectweb.celtix/celtix-rt

  protected Object parsePropertySubElement(Element valueElement, String beanName) {

    if (valueElement.getTagName().equals(VALUE_ELEMENT)) {
      for (Node nd = valueElement.getFirstChild(); nd != null; nd = nd.getNextSibling()) {
        if (Node.ELEMENT_NODE == nd.getNodeType()) {
          return nd;
        }
      }
    }
    return super.parsePropertySubElement(valueElement, beanName);
  }
}
origin: org.apache.xbean/xbean-spring-v1

/**
 * Attempts to load the class on the current thread context class loader or
 * the class loader which loaded us
 */
protected Class loadClass(String name) throws ClassNotFoundException {
  ClassLoader beanClassLoader = getBeanDefinitionReader().getBeanClassLoader();
  if (beanClassLoader != null) {
    try {
      return beanClassLoader.loadClass(name);
    }
    catch (ClassNotFoundException e) {
    }
  }
  ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
  if (contextClassLoader != null) {
    try {
      return contextClassLoader.loadClass(name);
    }
    catch (ClassNotFoundException e) {
    }
  }
  return getClass().getClassLoader().loadClass(name);
}
origin: org.apache.xbean/xbean-spring-v1

protected BeanDefinitionHolder parseBeanDefinitionElement(Element ele, boolean isInnerBean) throws BeanDefinitionStoreException {
  BeanDefinitionHolder bdh = super.parseBeanDefinitionElement(ele, isInnerBean);
  coerceNamespaceAwarePropertyValues(bdh, ele);
  return bdh;
}
origin: springframework/spring-beans

/**
 * Parses bean definitions according to the "spring-beans" DTD.
 * <p>Opens a DOM Document; then initializes the default settings
 * specified at <code>&lt;beans&gt;</code> level; then parses
 * the contained bean definitions.
 */
public int registerBeanDefinitions(BeanDefinitionReader reader, Document doc, Resource resource)
    throws BeanDefinitionStoreException {
  this.beanDefinitionReader = reader;
  this.resource = resource;
  logger.debug("Loading bean definitions");
  Element root = doc.getDocumentElement();
  initDefaults(root);
  if (logger.isDebugEnabled()) {
    logger.debug("Default lazy init '" + getDefaultLazyInit() + "'");
    logger.debug("Default autowire '" + getDefaultAutowire() + "'");
    logger.debug("Default dependency check '" + getDefaultDependencyCheck() + "'");
  }
  preProcessXml(root);
  int beanDefinitionCount = parseBeanDefinitions(root);
  if (logger.isDebugEnabled()) {
    logger.debug("Found " + beanDefinitionCount + " <bean> elements in " + resource);
  }
  postProcessXml(root);
  return beanDefinitionCount;
}
origin: springframework/spring-beans

/**
 * Parse a key sub-element of a map element.
 */
protected Object parseKeyElement(Element keyEle, String beanName) throws BeanDefinitionStoreException {
  NodeList nl = keyEle.getChildNodes();
  Element subElement = null;
  for (int i = 0; i < nl.getLength(); i++) {
    if (nl.item(i) instanceof Element) {
      Element candidateEle = (Element) nl.item(i);
      // Child element is what we're looking for.
      if (subElement != null) {
        throw new BeanDefinitionStoreException(
            getResource(), beanName, "<key> must not contain more than one value sub-element");
      }
      subElement = candidateEle;
    }
  }
  return parsePropertySubElement(subElement, beanName);
}
origin: springframework/spring-beans

ConstructorArgumentValues cargs = parseConstructorArgElements(ele, beanName);
MutablePropertyValues pvs = parsePropertyElements(ele, beanName);
    className, parent, cargs, pvs, getBeanDefinitionReader().getBeanClassLoader());
  dependencyCheck = getDefaultDependencyCheck();
bd.setDependencyCheck(getDependencyCheck(dependencyCheck));
  autowire = getDefaultAutowire();
bd.setAutowireMode(getAutowireMode(autowire));
parseLookupOverrideSubElements(ele, beanName, bd.getMethodOverrides());
parseReplacedMethodSubElements(ele, beanName, bd.getMethodOverrides());
bd.setResourceDescription(getResource().getDescription());
if (DEFAULT_VALUE.equals(lazyInit) && bd.isSingleton()) {
  lazyInit = getDefaultLazyInit();
    getResource(), beanName, "Bean class [" + className + "] not found", ex);
    getResource(), beanName, "Class that bean class [" + className + "] depends on not found", err);
origin: springframework/spring-beans

return parseBeanDefinitionElement(ele, true);
    if (!StringUtils.hasLength(beanRef)) {
      throw new BeanDefinitionStoreException(
          getResource(), beanName, "'bean', 'local' or 'parent' is required for a reference");
  if (!StringUtils.hasLength(beanRef)) {
    throw new BeanDefinitionStoreException(
        getResource(), beanName, "Either 'bean' or 'local' is required for an idref");
        getResource(), beanName, "Value type class [" + typeClassName + "] not found", ex);
return parseListElement(ele, beanName);
return parseSetElement(ele, beanName);
return parseMapElement(ele, beanName);
return parsePropsElement(ele, beanName);
  getResource(), beanName, "Unknown property sub-element: <" + ele.getTagName() + ">");
origin: springframework/spring-beans

    if (keyEle != null) {
      throw new BeanDefinitionStoreException(
          getResource(), beanName, "<entry> is only allowed to contain one <key> sub-element");
          getResource(), beanName, "<entry> must not contain more than one value sub-element");
  ((hasKeyAttribute || hasKeyRefAttribute)) && keyEle != null) {
throw new BeanDefinitionStoreException(
    getResource(), beanName, "<entry> is only allowed to contain either " +
    "a 'key' attribute OR a 'key-ref' attribute OR a <key> sub-element");
key = parseKeyElement(keyEle, beanName);
    getResource(), beanName, "<entry> must specify a key");
  ((hasValueAttribute || hasValueRefAttribute)) && valueEle != null) {
throw new BeanDefinitionStoreException(
    getResource(), beanName, "<entry> is only allowed to contain either " +
    "a 'value' attribute OR a 'value-ref' attribute OR a value sub-element");
value = parsePropertySubElement(valueEle, beanName);
    getResource(), beanName, "<entry> must specify a value");
origin: springframework/spring-beans

/**
 * Parse the elements at the root level in the document:
 * "import", "alias", "bean".
 * @param root the DOM root element of the document
 * @return the number of bean definitions found
 */
protected int parseBeanDefinitions(Element root) throws BeanDefinitionStoreException {
  NodeList nl = root.getChildNodes();
  int beanDefinitionCount = 0;
  for (int i = 0; i < nl.getLength(); i++) {
    Node node = nl.item(i);
    if (node instanceof Element) {
      Element ele = (Element) node;
      if (IMPORT_ELEMENT.equals(node.getNodeName())) {
        importBeanDefinitionResource(ele);
      }
      else if (ALIAS_ELEMENT.equals(node.getNodeName())) {
        String name = ele.getAttribute(NAME_ATTRIBUTE);
        String alias = ele.getAttribute(ALIAS_ATTRIBUTE);
        this.beanDefinitionReader.getBeanFactory().registerAlias(name, alias);
      }
      else if (BEAN_ELEMENT.equals(node.getNodeName())) {
        beanDefinitionCount++;
        BeanDefinitionHolder bdHolder = parseBeanDefinitionElement(ele, false);
        BeanDefinitionReaderUtils.registerBeanDefinition(bdHolder, this.beanDefinitionReader.getBeanFactory());
      }
    }
  }
  return beanDefinitionCount;
}
origin: org.apache.xbean/xbean-spring-v1

    Element ele = (Element) node;
    if (IMPORT_ELEMENT.equals(node.getNodeName())) {
      importBeanDefinitionResource(ele);
      getBeanDefinitionReader().getBeanFactory().registerAlias(name, alias);
      BeanDefinitionReaderUtils.registerBeanDefinition(bdHolder, getBeanDefinitionReader()
          .getBeanFactory());
      if (bdHolder != null) {
        beanDefinitionCount++;
        BeanDefinitionReaderUtils.registerBeanDefinition(bdHolder, getBeanDefinitionReader()
            .getBeanFactory());
if (bdHolder != null) {
  beanDefinitionCount++;
  BeanDefinitionReaderUtils.registerBeanDefinition(bdHolder, getBeanDefinitionReader()
      .getBeanFactory());
origin: springframework/spring-beans

/**
 * Parse an "import" element and load the bean definitions
 * from the given resource into the bean factory.
 */
protected void importBeanDefinitionResource(Element ele) throws BeanDefinitionStoreException {
  String location = ele.getAttribute(RESOURCE_ATTRIBUTE);
  // Resolve system properties: e.g. "${user.dir}"
  location = SystemPropertyUtils.resolvePlaceholders(location);
  if (ResourcePatternUtils.isUrl(location)) {
    int importCount = getBeanDefinitionReader().loadBeanDefinitions(location);
    if (logger.isDebugEnabled()) {
      logger.debug("Imported " + importCount + " bean definitions from URL location [" + location + "]");
    }
  }
  else {
    // No URL -> considering resource location as relative to the current file.
    try {
      Resource relativeResource = getResource().createRelative(location);
      int importCount = getBeanDefinitionReader().loadBeanDefinitions(relativeResource);
      if (logger.isDebugEnabled()) {
        logger.debug("Imported " + importCount + " bean definitions from relative location [" + location + "]");
      }
    }
    catch (IOException ex) {
      throw new BeanDefinitionStoreException(
          "Invalid relative resource location [" + location + "] to import bean definitions from", ex);
    }
  }
}
origin: org.apache.xbean/xbean-spring-v1

/**
 * Attempts to use introspection to parse the nested property element.
 */
private Object parseNestedPropertyViaIntrospection(MappingMetaData metadata, Element element, String propertyName, Class propertyType) {
  if (isMap(propertyType)) {
    return parseCustomMapElement(metadata, element, propertyName);
  } else if (isCollection(propertyType)) {
    return parseListElement(element, propertyName);
  } else {
    return parseChildExtensionBean(element);
  }
}
origin: springframework/spring-beans

            getResource(), beanName, elementName + " must not contain more than one sub-element");
    ((hasRefAttribute || hasValueAttribute)) && subElement != null) {
  throw new BeanDefinitionStoreException(
      getResource(), beanName, elementName +
      " is only allowed to contain either a 'ref' attribute OR a 'value' attribute OR a sub-element");
      getResource(), beanName, elementName + " must specify a ref or value");
return parsePropertySubElement(subElement, beanName);
origin: org.apache.xbean/xbean-spring-v1

String propertyName = metadata.getNestedListProperty(getLocalName(element), localName);
if (propertyName != null) {
  value = parseListElement(childElement, propertyName);
origin: springframework/spring-beans

/**
 * Parse a list element.
 */
protected List parseListElement(Element collectionEle, String beanName) throws BeanDefinitionStoreException {
  NodeList nl = collectionEle.getChildNodes();
  ManagedList list = new ManagedList(nl.getLength());
  for (int i = 0; i < nl.getLength(); i++) {
    if (nl.item(i) instanceof Element) {
      Element ele = (Element) nl.item(i);
      list.add(parsePropertySubElement(ele, beanName));
    }
  }
  return list;
}
origin: springframework/spring-beans

BeanDefinition beanDefinition = parseBeanDefinitionElement(ele, beanName);
origin: org.apache.xbean/xbean-spring-v1

/**
 * Loads the resource from the given URI
 */
protected InputStream loadResource(String uri) {
  if (System.getProperty("xbean.dir") != null) {
    File f = new File(System.getProperty("xbean.dir") + uri);
    try {
      return new FileInputStream(f);
    } catch (FileNotFoundException e) {
      // Ignore
    }
  }
  // lets try the thread context class loader first
  InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(uri);
  if (in == null) {
    ClassLoader cl = getBeanDefinitionReader().getBeanClassLoader();
    if (cl != null) {
      in = cl.getResourceAsStream(uri);
    }
    if (in == null) {
      in = getClass().getClassLoader().getResourceAsStream(uri);
      if (in == null) {
        logger.debug("Could not find resource: " + uri);
      }
    }
  }
  return in;
}
origin: springframework/spring-beans

/**
 * Parse a set element.
 */
protected Set parseSetElement(Element collectionEle, String beanName) throws BeanDefinitionStoreException {
  NodeList nl = collectionEle.getChildNodes();
  ManagedSet set = new ManagedSet(nl.getLength());
  for (int i = 0; i < nl.getLength(); i++) {
    if (nl.item(i) instanceof Element) {
      Element ele = (Element) nl.item(i);
      set.add(parsePropertySubElement(ele, beanName));
    }
  }
  return set;
}
origin: org.apache.xbean/xbean-spring-v1

protected Object parsePropertySubElement(Element element, String beanName) throws BeanDefinitionStoreException {
  String uri = element.getNamespaceURI();
  String localName = getLocalName(element);
  if ((!isEmpty(uri) && !(uri.equals(SPRING_SCHEMA) || uri.equals(SPRING_SCHEMA_COMPAT)))
      || !reservedElementNames.contains(localName)) {
    Object answer = parseBeanFromExtensionElement(element);
    if (answer != null) {
      return answer;
    }
  }
  if (QNAME_ELEMENT.equals(localName) && isQnameIsOnClassPath()) {
    Object answer = parseQNameElement(element);
    if (answer != null) {
      return answer;
    }
  }
  return super.parsePropertySubElement(element, beanName);
}
org.springframework.beans.factory.xmlDefaultXmlBeanDefinitionParser

Javadoc

Default implementation of the XmlBeanDefinitionParser interface. Parses bean definitions according to the "spring-beans" DTD, that is, Spring's default XML bean definition format.

The structure, elements and attribute names of the required XML document are hard-coded in this class. (Of course a transform could be run if necessary to produce this format). <beans> doesn't need to be the root element of the XML document: This class will parse all bean definition elements in the XML file, not regarding the actual root element.

Most used methods

  • parsePropertySubElement
    Parse a value, ref or collection sub-element of a property or constructor-arg element.
  • getBeanDefinitionReader
    Return the BeanDefinitionReader that this parser has been called from.
  • importBeanDefinitionResource
    Parse an "import" element and load the bean definitions from the given resource into the bean factor
  • parseBeanDefinitionElement
    Parse a standard bean definition into a BeanDefinitionHolder, including bean name and aliases.Bean e
  • parseListElement
    Parse a list element.
  • getAutowireMode
  • getDefaultAutowire
    Return the default autowire setting for the document that's currently parsed.
  • getDefaultDependencyCheck
    Return the default dependency-check setting for the document that's currently parsed.
  • getDefaultLazyInit
    Return the default lazy-init flag for the document that's currently parsed.
  • getDependencyCheck
  • getResource
    Return the descriptor for the XML resource that this parser works on.
  • initDefaults
    Initialize the default lazy-init, autowire and dependency check settings.
  • getResource,
  • initDefaults,
  • parseBeanDefinitions,
  • parseConstructorArgElement,
  • parseConstructorArgElements,
  • parseKeyElement,
  • parseLookupOverrideSubElements,
  • parseMapElement,
  • parsePropertyElement,
  • parsePropertyElements

Popular in Java

  • Creating JSON documents from java classes using gson
  • setRequestProperty (URLConnection)
  • scheduleAtFixedRate (Timer)
    Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
  • onRequestPermissionsResult (Fragment)
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • InputStreamReader (java.io)
    An InputStreamReader is a bridge from byte streams to character streams: It reads bytes and decodes
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now