Package org.springframework.beans.factory.xml

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


  private CollectingReaderEventListener listener = new CollectingReaderEventListener();

  public void setUp() {
    this.beanFactory = new DefaultListableBeanFactory();
    XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(this.beanFactory);
    reader.setEventListener(this.listener);
    reader.loadBeanDefinitions(new ClassPathResource("testUtilNamespace.xml", getClass()));
  }
View Full Code Here


    String[] scopeNames = applicationContext.getBeanFactory().getRegisteredScopeNames();
    assertEquals(1, scopeNames.length);
    assertEquals("myScope", scopeNames[0]);
    assertSame(scope, applicationContext.getBeanFactory().getRegisteredScope("myScope"));

    XmlBeanDefinitionReader xbdr = new XmlBeanDefinitionReader(applicationContext);
    xbdr.loadBeanDefinitions("org/springframework/beans/factory/config/simpleScope.xml");
   
    applicationContext.refresh();
  }
View Full Code Here

    assertEquals("Wuby", fr.getObject());
  }

  public void testBeanNameSyntaxWithBeanFactory() throws Exception {
    DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
    new XmlBeanDefinitionReader(bf).loadBeanDefinitions(new ClassPathResource("fieldRetrieving.xml", getClass()));
    TestBean testBean = (TestBean) bf.getBean("testBean");
    assertEquals(new Integer(Connection.TRANSACTION_SERIALIZABLE), testBean.getSomeIntegerArray()[0]);
    assertEquals(new Integer(Connection.TRANSACTION_SERIALIZABLE), testBean.getSomeIntegerArray()[1]);
  }
View Full Code Here

     */
    public static ApplicationContext getApplicationContext(List<String> additionalFilePathnames) {
        BusApplicationContext busApplicationContext = BusFactory.getDefaultBus()
            .getExtension(BusApplicationContext.class);
        GenericApplicationContext appContext = new GenericApplicationContext(busApplicationContext);
        XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(appContext);
        List<URL> urls = ClassLoaderUtils.getResources("META-INF/cxf/java2wsbeans.xml",
                                                       SpringServiceBuilderFactory.class);
        for (URL url : urls) {
            reader.loadBeanDefinitions(new UrlResource(url));
        }
       
        for (String pathname : additionalFilePathnames) {
            try {
                reader.loadBeanDefinitions(new FileSystemResource(pathname));
            } catch (BeanDefinitionStoreException bdse) {
                throw new ToolException("Unable to open bean definition file " + pathname, bdse.getCause());
            }
        }

View Full Code Here

    private GenericApplicationContext applicationContext;
   
   
       
    private void readBeans(Resource beanResource) {
        XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(applicationContext);
        reader.loadBeanDefinitions(beanResource);
    }
View Full Code Here

       
        if (is != null) {
            LOG.log(Level.INFO, "BUILD_ENDPOINTS_FROM_CONFIG_LOCATION", new Object[]{location});
            childCtx = new GenericApplicationContext(ctx);
           
            XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(childCtx);
            reader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_XSD);
            reader.loadBeanDefinitions(new InputStreamResource(is, location));
           
            childCtx.refresh();
        }
    }
View Full Code Here

public class GenericApplicationContextUtil {
    public static GenericApplicationContext getSpringApplicationContext(
            InputStream applicationContxtInStream, String springBeansFilePath) throws AxisFault {
        GenericApplicationContext appContext = new GenericApplicationContext();

        XmlBeanDefinitionReader xbdr = new XmlBeanDefinitionReader(appContext);
        xbdr.setValidating(false);
        xbdr.loadBeanDefinitions(new InputStreamResource(applicationContxtInStream));
        appContext.refresh();
        return appContext;
    }
View Full Code Here

        GenericApplicationContext appContext = new GenericApplicationContext();
        appContext.setClassLoader(classLoader);
        ClassLoader prevCl = Thread.currentThread().getContextClassLoader();
        try {
            Thread.currentThread().setContextClassLoader(classLoader);
            XmlBeanDefinitionReader xbdr = new XmlBeanDefinitionReader(appContext);
            xbdr.setValidating(false);
            InputStream in = classLoader.getResourceAsStream(relPath);
            if (in == null) {
                throw new AxisFault("Spring context cannot be located for AxisService");
            }
            xbdr.loadBeanDefinitions(new InputStreamResource(in));
            appContext.refresh();
        } catch (Exception e) {
            throw AxisFault.makeFault(e);
        } finally {
            // Restore
View Full Code Here

            // Save the class loader so that you can restore it later
            Thread.currentThread()
                    .setContextClassLoader(
                            new MultiParentClassLoader(new URL[]{}, new ClassLoader[]{
                                    springBeansClassLoader, prevCl}));
            XmlBeanDefinitionReader xbdr = new XmlBeanDefinitionReader(appContext);
            xbdr.setValidating(false);
            xbdr.loadBeanDefinitions(new InputStreamResource(
                    new FileInputStream(new File(applicationContxtFilePath))));
            appContext.refresh();
        } catch (FileNotFoundException e) {
            throw AxisFault.makeFault(e);
        } finally {
View Full Code Here

public class GenericApplicationContextUtil {
    public static GenericApplicationContext getSpringApplicationContext(
            InputStream applicationContxtInStream, String springBeansFilePath) throws AxisFault {
        GenericApplicationContext appContext = new GenericApplicationContext();

        XmlBeanDefinitionReader xbdr = new XmlBeanDefinitionReader(appContext);
        xbdr.setValidating(false);
        xbdr.loadBeanDefinitions(new InputStreamResource(applicationContxtInStream));
        appContext.refresh();
        return appContext;
    }
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.