Examples of XmlBeanFactory


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

      configPath) {
    if(factory != null) {
      return factory;
    }
    Resource resource = new FileSystemResource(configPath);
    XmlBeanFactory xmlFactory = new XmlBeanFactory(resource);
    factory = (ExclusionFilterFactory) xmlFactory.getBean(CONFIG_ID);
    return factory;
  }
View Full Code Here

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

      throw new ConfigurationException("Missing " + CONFIG_PATH
          + " parameter");
    }
    String resolvedPath = servletContext.getRealPath(configPath);
    Resource resource = new FileSystemResource(resolvedPath);
    factory = new XmlBeanFactory(resource);
    factory.preInstantiateSingletons();
  }
View Full Code Here

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

        // Spring setup

        ClassPathResource springBeansResource =
            new ClassPathResource("SpringBeans.xml", TestSpringLookupFactory.class);

        BeanFactory beanFactory = new XmlBeanFactory(springBeansResource);

        Registry r = buildFrameworkRegistry("SpringIntegration.sdl");

        SpringBeanFactoryHolder h =
            (SpringBeanFactoryHolder) r.getService(
View Full Code Here

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

            + "http://mina.apache.org/ftpserver/spring/v1 http://mina.apache.org/ftpserver/ftpserver-1.0.xsd "
            + "\">"
            + config
            + "</server>";

        XmlBeanFactory factory = new XmlBeanFactory(
                new ByteArrayResource(completeConfig.getBytes()));
       
        return (FtpServer) factory.getBean("server");

    }
View Full Code Here

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

*
*/
public class SpringConfigTest extends TestCase {

    public void test() throws Throwable {
        XmlBeanFactory factory = new XmlBeanFactory(new FileSystemResource(
                "src/test/resources/spring-config/config-spring-1.xml"));

        DefaultFtpServer server = (DefaultFtpServer) factory.getBean("server");

        assertEquals(500, server.getConnectionConfig().getMaxLogins());
        assertEquals(false, server.getConnectionConfig()
                .isAnonymousLoginEnabled());
        assertEquals(123, server.getConnectionConfig().getMaxAnonymousLogins());
View Full Code Here

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

            throw new TuboResourceException("Tubo configuration can't be created",e);
        }
        //
        // create Bean Factory
        ByteArrayResource byteResource = new ByteArrayResource(stringResource.getBytes());
        BeanFactory beanFactory = new XmlBeanFactory(byteResource);
        //
        // get resource manager
        SpringResourceManagerImpl rm = null;
        try {
            //
            // get FlowExecutor via Spring
            rm = (SpringResourceManagerImpl)beanFactory.getBean(SPRING_RESOURCE_MANAGER_BEAN_ID);
        } catch (BeansException e) {
            //
            // log error
            log.error("Error trying to get ResourceManager", e);
            //
View Full Code Here

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

* @author robh
*/
public class ShutdownHookExample {

    public static void main(String[] args) {
        ConfigurableListableBeanFactory factory = new XmlBeanFactory(
                new FileSystemResource(
                        "./ch5/src/conf/lifecycle/disposeInterface.xml"));

        Runtime.getRuntime().addShutdownHook(
                new Thread(new ShutdownHook(factory)));
        DestructiveBeanWithInterface bean = (DestructiveBeanWithInterface) factory.getBean("destructiveBean");
    }
View Full Code Here

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

*/
public class LookupPerformance {

    public static void main(String[] args) {

        BeanFactory factory = new XmlBeanFactory(new FileSystemResource(
                "./ch5/src/conf/mi/lookup.xml"));

        DemoBean abstractBean = (DemoBean) factory.getBean("abstractLookupBean");
        DemoBean factoryBean = (DemoBean) factory.getBean("factoryLookupBean");

        testPerf(abstractBean);
        testPerf(factoryBean);
    }
View Full Code Here

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

    public void setFilePath(String filePath) {
        this.filePath = filePath;
    }

    public static void main(String[] args) throws Exception {
        ConfigurableListableBeanFactory factory = new XmlBeanFactory(
                new FileSystemResource(
                        "./ch5/src/conf/lifecycle/disposeMethod.xml"));

       
        DestructiveBean bean = (DestructiveBean) factory.getBean("destructiveBean");
       
        System.out.println("Calling destroySingletons()");
        factory.destroySingletons();
        System.out.println("Called destroySingletons()");
    }
View Full Code Here

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

    public String toString() {
        return "Name: " + name + "\nAge: " + age;
    }

    public static void main(String[] args) {
        BeanFactory factory = new XmlBeanFactory(new FileSystemResource(
                "./ch5/src/conf/lifecycle/initInterface.xml"));

        SimpleBeanWithInterface simpleBean1 = getBean("simpleBean1", factory);
        SimpleBeanWithInterface simpleBean2 = getBean("simpleBean2", factory);
        SimpleBeanWithInterface simpleBean3 = getBean("simpleBean3", factory);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.