Package org.springframework.context.support

Examples of org.springframework.context.support.GenericApplicationContext.refresh()


    // create the bean definition reader
    XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(context);
    xmlReader.loadBeanDefinitions(new ClassPathResource("dynamic/dynamic-context.xml", classLoader));

    // refresh the application context - now we're ready to go
    context.refresh();

    assertNotNull(context.getBean("communicationMethod"));
    assertNotNull(context.getBean("communicationMethodImpl"));

    Person ti = (Person) context.getBean("person");
View Full Code Here


    GenericApplicationContext context = new GenericApplicationContext();

    XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(context);
    xmlReader.loadBeanDefinitions(new ClassPathResource("expandable/core-context.xml"));

    context.refresh();

    RootModuleContextMonitor monitor = new RootModuleContextMonitor(xmlReader, new ClassPathResource(
        "expandable/spring-locations.txt"), new ScheduledThreadPoolExecutor(1));
    monitor.setupMonitor();
View Full Code Here

        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());
View Full Code Here

        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

  protected ConfigurableApplicationContext createApplicationContext(String[] locations) {
    GenericApplicationContext context = new GenericApplicationContext();
    prepareApplicationContext(context);
    customizeBeanFactory(context.getDefaultListableBeanFactory());
    createBeanDefinitionReader(context).loadBeanDefinitions(locations);
    context.refresh();
    return context;
  }

  /**
   * Prepare the GenericApplicationContext used by this test.
View Full Code Here

  protected ConfigurableApplicationContext createApplicationContext(String[] locations) {
    GenericApplicationContext context = new GenericApplicationContext();
    prepareApplicationContext(context);
    customizeBeanFactory(context.getDefaultListableBeanFactory());
    createBeanDefinitionReader(context).loadBeanDefinitions(locations);
    context.refresh();
    return context;
  }

  /**
   * Prepare the GenericApplicationContext used by this test.
View Full Code Here

     *         to exclude certain classes from package scanning
     */
    protected ApplicationContext getRouteExcludingApplicationContext() {
        GenericApplicationContext routeExcludingContext = new GenericApplicationContext();
        routeExcludingContext.registerBeanDefinition("excludingResolver", new RootBeanDefinition(ExcludingPackageScanClassResolver.class));
        routeExcludingContext.refresh();

        ExcludingPackageScanClassResolver excludingResolver = (ExcludingPackageScanClassResolver)routeExcludingContext.getBean("excludingResolver");
        List<Class<?>> excluded = CastUtils.cast(Arrays.asList(excludeRoutes()));
        excludingResolver.setExcludedClasses(new HashSet<Class<?>>(excluded));

View Full Code Here

     *         to exclude certain classes from package scanning
     */
    protected ApplicationContext getRouteExcludingApplicationContext() {
        GenericApplicationContext routeExcludingContext = new GenericApplicationContext();
        routeExcludingContext.registerBeanDefinition("excludingResolver", new RootBeanDefinition(ExcludingPackageScanClassResolver.class));
        routeExcludingContext.refresh();

        ExcludingPackageScanClassResolver excludingResolver = (ExcludingPackageScanClassResolver)routeExcludingContext.getBean("excludingResolver");
        List<Class<?>> excluded = CastUtils.cast(Arrays.asList(excludeRoutes()));
        excludingResolver.setExcludedClasses(new HashSet<Class<?>>(excluded));

View Full Code Here

    prepareContext(context);
    customizeBeanFactory(context.getDefaultListableBeanFactory());
    loadBeanDefinitions(context, mergedConfig);
    AnnotationConfigUtils.registerAnnotationConfigProcessors(context);
    customizeContext(context);
    context.refresh();
    context.registerShutdownHook();
    return context;
  }

  /**
 
View Full Code Here

    prepareContext(context);
    customizeBeanFactory(context.getDefaultListableBeanFactory());
    createBeanDefinitionReader(context).loadBeanDefinitions(locations);
    AnnotationConfigUtils.registerAnnotationConfigProcessors(context);
    customizeContext(context);
    context.refresh();
    context.registerShutdownHook();
    return context;
  }

  /**
 
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.