Package org.springframework.context.support

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


    //ConfigurableApplicationContext parent = new GenericApplicationContext();
//    parent.refresh();

    ConfigurableApplicationContext child = new ClassPathXmlApplicationContext();
    child.setEnvironment(new StandardEnvironment());
    child.refresh();

    child.close();
//    parent.close();

//    Object ac2 = new GenericXmlApplicationContext();
View Full Code Here


  public void success() {

    ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext();
    context.setConfigLocation("classpath:org/springframework/issues/config.xml");
    context.getEnvironment().setActiveProfiles("success");
    context.refresh();

    TestInitializingBean bean = context.getBean(TestInitializingBean.class);

    assertTrue(Proxy.isProxyClass(bean.getControllerType()));
  }
View Full Code Here

  public void failure() {

    ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext();
    context.setConfigLocation("classpath:org/springframework/issues/config.xml");
    context.getEnvironment().setActiveProfiles("failure");
    context.refresh();

    TestInitializingBean bean = context.getBean(TestInitializingBean.class);

    assertTrue(Proxy.isProxyClass(bean.getControllerType()));
  }
View Full Code Here

    server = new Server();

    try {
      ClassPathXmlApplicationContext parentSpringAppContext =
          new ClassPathXmlApplicationContext();
      parentSpringAppContext.refresh();
      ConfigurableListableBeanFactory factory = parentSpringAppContext.
          getBeanFactory();
      factory.registerSingleton("guiceInjector",
          injector);
      factory.registerSingleton("passwordEncoder",
View Full Code Here

    @Test
    public void testLoadBusWithApplicationContext() throws BusException {
        ClassPathXmlApplicationContext ctx =
            new ClassPathXmlApplicationContext(new String[] {"/org/apache/cxf/systest/bus/basic.xml"});
        Bus bus = ctx.getBean("cxf", Bus.class);
        ctx.refresh();
        bus = ctx.getBean("cxf", Bus.class);
        checkBindingExtensions(bus);
        checkHTTPTransportFactories(bus);
        checkOtherCoreExtensions(bus);
        ctx.destroy();
View Full Code Here

  @Test
  public void classPathXmlApplicationContext() {
    ConfigurableApplicationContext ctx = new ClassPathXmlApplicationContext(XML_PATH);
    ctx.setEnvironment(prodEnv);
    ctx.refresh();

    assertEnvironmentBeanRegistered(ctx);
    assertHasEnvironment(ctx, prodEnv);
    assertEnvironmentAwareInvoked(ctx, ctx.getEnvironment());
    assertThat(ctx.containsBean(DEV_BEAN_NAME), is(false));
View Full Code Here

    }
    { // ensure the same works for AbstractRefreshableApplicationContext impls too
      ConfigurableApplicationContext context = new ClassPathXmlApplicationContext(new String[] { xmlLocation },
        false);
      context.getEnvironment().setActiveProfiles(ProfileAnnotatedComponent.PROFILE_NAME);
      context.refresh();
      assertThat(context.containsBean(ProfileAnnotatedComponent.BEAN_NAME), is(true));
      context.close();
    }
  }
View Full Code Here

                DefaultListableBeanFactory f = super.createBeanFactory();
                f.addBeanPostProcessor(new BundleContextAwareProcessor(bundleContext));
                return f;
            }
        };
        ctx.refresh();

        // Test realm
        Object obj = ctx.getBean("realm");
        assertNotNull(obj);
        assertTrue(obj instanceof Config);
View Full Code Here

    private void createAppCtxAndPropagateRootExceptionIfThrown(Class entityUnderTest) throws Throwable {
        try {
            ClassPathXmlApplicationContext appCtx = new ClassPathXmlApplicationContext();
            appCtx.setConfigLocation("org/springframework/data/neo4j/aspects/support/illegal-index1-tests-context.xml");
            appCtx.getEnvironment().setActiveProfiles( entityUnderTest.getSimpleName() );
            appCtx.refresh();
        } catch (BeanCreationException bce) {
            Throwable ex=bce;
            while (ex.getCause() != null) ex = ex.getCause();
            throw ex;
        }
View Full Code Here

    private void createAppCtxAndPropagateRootExceptionIfThrown(Class entityUnderTest) throws Throwable {
        try {
            ClassPathXmlApplicationContext appCtx = new ClassPathXmlApplicationContext();
            appCtx.setConfigLocation("org/springframework/data/neo4j/aspects/support/illegal-index2-tests-context.xml");
            appCtx.getEnvironment().setActiveProfiles( entityUnderTest.getSimpleName() );
            appCtx.refresh();
        } catch (BeanCreationException bce) {
            Throwable ex=bce;
            while (ex.getCause() != null) ex = ex.getCause();
            throw ex;
        }
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.