Package org.springframework.context.support

Examples of org.springframework.context.support.GenericApplicationContext


       
        DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
        beanFactory.setBeanClassLoader(classLoader);

        // create the application context, and set the class loader
        GenericApplicationContext context = new GenericApplicationContext(beanFactory, parent);
        context.setClassLoader(classLoader);
        context.setDisplayName(ModuleLoaderUtils.getDisplayName(definition, context));
        return context;
    }
View Full Code Here


public class ApplicationContextExporterTest extends TestCase {

    public void testAfterPropertiesSet() throws Exception {
        final ServletContext servletContext = createMock(ServletContext.class);
        final ApplicationContextExporter exporter = new ApplicationContextExporter();
        final GenericApplicationContext applicationContext = new GenericApplicationContext();
       
        exporter.setServletContext(servletContext);
        exporter.setApplicationContext(applicationContext);
        exporter.setContextAttribute("att");
   
View Full Code Here

       
        DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
        beanFactory.setBeanClassLoader(classLoader);

        // create the application context, and set the class loader
        GenericApplicationContext context = new GenericApplicationContext(beanFactory, parent);
        context.setClassLoader(classLoader);
        context.setDisplayName(ModuleLoaderUtils.getDisplayName(definition, context));
        return context;
    }
View Full Code Here

       
        DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
        beanFactory.setBeanClassLoader(classLoader);

        // create the application context, and set the class loader
        GenericApplicationContext context = new GenericApplicationContext(beanFactory, parent);
        context.setClassLoader(classLoader);
        context.setDisplayName(ModuleLoaderUtils.getDisplayName(definition, context));
        return context;
    }
View Full Code Here

public class DynamicPropertiesNamespaceHandlerTest extends TestCase {
   
    public void testDefault() throws Exception {
       
        GenericApplicationContext context = new GenericApplicationContext();
       
        XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
        reader.loadBeanDefinitions(new ClassPathResource("org/impalaframework/spring/config/dynamicproperties-context.xml"));
       
        context.refresh();
        DynamicPropertiesBean bean = (DynamicPropertiesBean) context.getBean("testBean");
        bean.print();
       
        assertEquals(true, bean.getBooleanValue());
        assertEquals(new SimpleDateFormat("yyyy-MM-dd").parse("1999-12-12"), bean.getDateValue());
        assertEquals(100.1, bean.getDoubleValue());
        assertEquals(10.2F, bean.getFloatValue());
        assertEquals(100, bean.getIntValue());
        assertEquals(2010L, bean.getLongValue());
        assertEquals("Phil", bean.getStringValue());
       
        StaticPropertiesPropertySource propertySource = (StaticPropertiesPropertySource) context.getBean("propertySource");
        final Properties properties = propertySource.getProperties();
        properties.setProperty("string.property", "Phil Z");
       
        //check that this updates
        assertEquals("Phil Z", bean.getStringValue());
View Full Code Here

*/
public class MissingBeanTest extends TestCase {

    public void test() {
        ProxyCreatingBeanFactory beanFactory = new ProxyCreatingBeanFactory();
        GenericApplicationContext context = new GenericApplicationContext(beanFactory);

        XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(context);
        xmlReader.loadBeanDefinitions(new ClassPathResource("missingbean/spring-context.xml"));

        context.refresh();
        ClientBean clientBean = (ClientBean) context.getBean("clientBean");

        System.out.println("\nOutput when client bean uses 'missing' collaborator:");
        clientBean.doStuff();
    }
View Full Code Here

        applicationContext = createMock(ConfigurableApplicationContext.class);
    }

    public void testCloseContextNoModuleLoader() {
        replay(applicationContext, moduleLoader);
        loader.closeContext("id", definition, new GenericApplicationContext());
        verify(applicationContext, moduleLoader);
    }
View Full Code Here

public class BaseSpringModuleLoaderTest extends TestCase {
   
    public void testNewBeanDefinitionReader() throws Exception {
       
        BaseSpringModuleLoader loader = new ApplicationModuleLoader();
        GenericApplicationContext context = new GenericApplicationContext();
        XmlBeanDefinitionReader reader = loader.newBeanDefinitionReader("id", context, new SimpleModuleDefinition("pluginName"));
        assertSame(context.getBeanFactory(), reader.getBeanFactory());
    }
View Full Code Here

    public void testNewApplicationContext() throws Exception {
        BaseSpringModuleLoader loader = new BaseSpringModuleLoader() {
        };
       
        GenericApplicationContext parentContext = new GenericApplicationContext();
        SimpleRootModuleDefinition rootDefinition = new SimpleRootModuleDefinition("project1", "context.xml");
        ClassLoader classLoader = ClassUtils.getDefaultClassLoader();
        GenericApplicationContext context = loader.newApplicationContext(null, parentContext, rootDefinition, classLoader);

        ModuleTestUtils.checkHasPostProcessor(false, context, ModuleDefinitionPostProcessor.class);
    }
View Full Code Here

   
    DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
    beanFactory.setBeanClassLoader(classLoader);

    // create the application context, and set the class loader
    GenericApplicationContext context = new GenericApplicationContext(beanFactory, parent);
    context.setClassLoader(classLoader);
    return context;
  }
View Full Code Here

TOP

Related Classes of org.springframework.context.support.GenericApplicationContext

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.