Package org.springframework.beans.factory.xml

Examples of org.springframework.beans.factory.xml.XmlBeanDefinitionReader


   * <p/> Loads the bean definitions via an
   * <code>XmlBeanDefinitionReader</code>.
   */
  protected void loadBeanDefinitions(DefaultListableBeanFactory beanFactory) throws IOException {
    // Create a new XmlBeanDefinitionReader for the given BeanFactory.
    XmlBeanDefinitionReader beanDefinitionReader = new XmlBeanDefinitionReader(beanFactory);

    // Configure the bean definition reader with this context's
    // resource loading environment.
    beanDefinitionReader.setResourceLoader(this);

    NamespaceHandlerResolver nsResolver = createNamespaceHandlerResolver(getBundleContext(), getClassLoader());
    EntityResolver enResolver = createEntityResolver(getBundleContext(), getClassLoader());

    beanDefinitionReader.setEntityResolver(enResolver);
    beanDefinitionReader.setNamespaceHandlerResolver(nsResolver);

    // Allow a subclass to provide custom initialisation of the reader,
    // then proceed with actually loading the bean definitions.
    initBeanDefinitionReader(beanDefinitionReader);
    loadBeanDefinitions(beanDefinitionReader);
View Full Code Here


   * @see #createApplicationContext(String[])
   * @see BeanDefinitionReader
   * @see XmlBeanDefinitionReader
   */
  protected BeanDefinitionReader createBeanDefinitionReader(GenericApplicationContext context) {
    return new XmlBeanDefinitionReader(context);
  }
View Full Code Here

   * @param registry the registry to load into
   * @param configLocations the parsed config locations
   * @see #setContextConfigLocation
   */
  protected void loadBeanDefinitions(BeanDefinitionRegistry registry, String[] configLocations) {
    new XmlBeanDefinitionReader(registry).loadBeanDefinitions(configLocations);
  }
View Full Code Here

   * @see #createApplicationContext(String[])
   * @see BeanDefinitionReader
   * @see XmlBeanDefinitionReader
   */
  protected BeanDefinitionReader createBeanDefinitionReader(GenericApplicationContext context) {
    return new XmlBeanDefinitionReader(context);
  }
View Full Code Here

    Map<String, SQLErrorCodes> errorCodes;

    try {
      DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
      lbf.setBeanClassLoader(getClass().getClassLoader());
      XmlBeanDefinitionReader bdr = new XmlBeanDefinitionReader(lbf);

      // Load default SQL error codes.
      Resource resource = loadResource(SQL_ERROR_CODE_DEFAULT_PATH);
      if (resource != null && resource.exists()) {
        bdr.loadBeanDefinitions(resource);
      }
      else {
        logger.warn("Default sql-error-codes.xml not found (should be included in spring.jar)");
      }

      // Load custom SQL error codes, overriding defaults.
      resource = loadResource(SQL_ERROR_CODE_OVERRIDE_PATH);
      if (resource != null && resource.exists()) {
        bdr.loadBeanDefinitions(resource);
        logger.info("Found custom sql-error-codes.xml file at the root of the classpath");
      }

      // Check all beans of type SQLErrorCodes.
      errorCodes = lbf.getBeansOfType(SQLErrorCodes.class, true, false);
View Full Code Here

   * @see #loadBeanDefinitions
   */
  @Override
  protected void loadBeanDefinitions(DefaultListableBeanFactory beanFactory) throws BeansException, IOException {
    // Create a new XmlBeanDefinitionReader for the given BeanFactory.
    XmlBeanDefinitionReader beanDefinitionReader = new XmlBeanDefinitionReader(beanFactory);

    // Configure the bean definition reader with this context's
    // resource loading environment.
    beanDefinitionReader.setEnvironment(this.getEnvironment());
    beanDefinitionReader.setResourceLoader(this);
    beanDefinitionReader.setEntityResolver(new ResourceEntityResolver(this));

    // Allow a subclass to provide custom initialization of the reader,
    // then proceed with actually loading the bean definitions.
    initBeanDefinitionReader(beanDefinitionReader);
    loadBeanDefinitions(beanDefinitionReader);
View Full Code Here

    final DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
    final GenericWebApplicationContext applicationContext = new GenericWebApplicationContext(beanFactory);
    applicationContext.setServletContext(servletContext);

    XmlBeanDefinitionReader definitionReader = new XmlBeanDefinitionReader(beanFactory);
    for (int i = 0; i < locations.length; i++) {
      definitionReader.loadBeanDefinitions(new ClassPathResource(locations[i]));
    }
    applicationContext.refresh();

    return ObjectUtils.cast(applicationContext.getBean("moduleManagementFactory"), ModuleManagementFactory.class);
  }
View Full Code Here

    GenericWebApplicationContext factory = new GenericWebApplicationContext();
    factory.setParent(getApplicationContext());
    factory.setServletContext(getServletContext());

    // Load XML resource with context-aware entity resolver.
    XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(factory);
    reader.setEnvironment(getApplicationContext().getEnvironment());
    reader.setEntityResolver(new ResourceEntityResolver(getApplicationContext()));
    reader.loadBeanDefinitions(actualLocation);

    factory.refresh();

    if (isCache()) {
      this.cachedFactory = factory;
View Full Code Here

   * @param registry the registry to load into
   * @param configLocations the parsed config locations
   * @see #setContextConfigLocation
   */
  protected void loadBeanDefinitions(BeanDefinitionRegistry registry, String[] configLocations) {
    new XmlBeanDefinitionReader(registry).loadBeanDefinitions(configLocations);
  }
View Full Code Here

   * @return a new XmlBeanDefinitionReader
   * @see XmlBeanDefinitionReader
   */
  @Override
  protected BeanDefinitionReader createBeanDefinitionReader(final GenericApplicationContext context) {
    return new XmlBeanDefinitionReader(context);
  }
View Full Code Here

TOP

Related Classes of org.springframework.beans.factory.xml.XmlBeanDefinitionReader

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.