Package org.springframework.context.support

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


        GenericApplicationContext applicationContext = new GenericApplicationContext();
        XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(applicationContext);
        xmlReader.loadBeanDefinitions(new ClassPathResource("org/apache/camel/spring/camelContextFactoryBean.xml"));

        // lets refresh to inject the applicationContext into beans
        applicationContext.refresh();

        CamelContext context = (CamelContext) applicationContext.getBean("camel3");
        assertValidContext(context);
    }
View Full Code Here


    protected ApplicationContext createParentApplicationContext(List xmlProcessors) {
        GenericApplicationContext answer = new GenericApplicationContext();
        answer.getBeanFactory().registerSingleton("jbi", component);
        answer.setClassLoader(Thread.currentThread().getContextClassLoader());
        answer.start();
        answer.refresh();
        return answer;
    }

}
View Full Code Here

        XmlBeanDefinitionReader xbdr = new XmlBeanDefinitionReader(appContext);
        xbdr.setValidating(false);
        xbdr.loadBeanDefinitions(new InputStreamResource(
            Util.getStreamSource(
                    synCtx.getConfiguration().getProperty(configKey)).getInputStream()));
        appContext.refresh();
        this.appContext = appContext;
    }

    private void handleException(String msg) {
        log.error(msg);
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 = routeExcludingContext.getBean("excludingResolver", ExcludingPackageScanClassResolver.class);
        List<Class<?>> excluded = CastUtils.cast(Arrays.asList(excludeRoutes()));
        excludingResolver.setExcludedClasses(new HashSet<Class<?>>(excluded));

View Full Code Here

        GenericApplicationContext applicationContext = new GenericApplicationContext();
        XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(applicationContext);
        xmlReader.loadBeanDefinitions(new ClassPathResource("org/apache/camel/spring/camelContextFactoryBean.xml"));

        // lets refresh to inject the applicationContext into beans
        applicationContext.refresh();

        CamelContext context = applicationContext.getBean("camel3", CamelContext.class);
        assertValidContext(context);
    }   
   
View Full Code Here

    DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
    factory.registerBeanDefinition("sqlSessionFactory", definition);

    genericApplicationContext.registerBeanDefinition("sqlSessionFactory", definition);

    genericApplicationContext.refresh();

    return genericApplicationContext;
  }

  private void assertBeanNotLoaded(String name) {
View Full Code Here

                // load the bean context file from the parameter
                if (contextLocationParam != null) {
                    xbdr.loadBeanDefinitions(new ClassPathResource((String) contextLocationParam
                            .getValue()));
                    appContext.refresh();
                    AxisServiceGroup axisServiceGroup = axisService.getAxisServiceGroup();
                    Parameter springGroupCtxLocation = axisServiceGroup
                            .getParameter(SPRING_APPLICATION_CONTEXT_LOCATION);
                    // add the context to the service group or add it to the
                    // service
View Full Code Here

                }
                // load the context file from meta-inf
                if (ctxFileInputStream != null) {
                    xbdr.setValidationMode(XmlBeanDefinitionReader.VALIDATION_NONE);
                    xbdr.loadBeanDefinitions(new InputStreamResource(ctxFileInputStream));
                    appContext.refresh();
                    axisService.addParameter(new Parameter(SPRING_APPLICATION_CONTEXT, appContext));
                    return appContext;
                } else {
                    throw new AxisFault("Spring context file cannot be located for AxisService");
                }
View Full Code Here

                reader.loadBeanDefinitions(new FileSystemResource(pathname));
            } catch (BeanDefinitionStoreException bdse) {
                throw new ToolException("Unable to open bean definition file " + pathname, bdse.getCause());
            }
        }
        appContext.refresh();
        return appContext;
    }

    public void setBeanDefinitions(List<String> beanDefinitions) {
        this.beanDefinitions = beanDefinitions;
View Full Code Here

    SpringYarnAnnotationPostProcessor postProcessor = new SpringYarnAnnotationPostProcessor();
    postProcessor.setBeanFactory(context.getBeanFactory());
    postProcessor.afterPropertiesSet();
    TestBean testBean = new TestBean();
    postProcessor.postProcessAfterInitialization(testBean, "testBean");
    context.refresh();
    assertTrue(context.containsBean("testBean.test.onContainerStart"));
    Object endpoint = context.getBean("testBean.test.onContainerStart");
    assertTrue(endpoint instanceof ContainerHandler);
    context.stop();
  }
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.