Package org.springframework.context.support

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


        }

        xbdr.loadBeanDefinitions(
            new InputStreamResource(
                SynapseConfigUtils.getStreamSource(springConfig).getInputStream()));
        appContext.refresh();
        if (synLog.isTraceOrDebugEnabled()) {
            synLog.traceOrDebug("Spring ApplicationContext from key : " + configKey + " created");
        }
        this.appContext = appContext;
    }
View Full Code Here


        log.info("Creating Spring Application Context ...");
        GenericApplicationContext ctx = new GenericApplicationContext();
        XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(ctx);
        reader.loadBeanDefinitions(new ClassPathResource("/applicationContext.xml"));

        ctx.refresh();
        return ctx;
    }
}
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

            context.setResourceLoader(resourceLoader);
            BeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
            for (String resource : resources) {
                reader.loadBeanDefinitions(resourceLoader.getResource(resource));
            }
            context.refresh();
            return context;
        }

    }
View Full Code Here

    when(factory.getObjectType()).thenReturn(PersonRepository.class);
    when(factory.getEntityInformation()).thenReturn(entityInformation);
    when(factory.getRepositoryInformation()).thenReturn(information);

    GenericApplicationContext context = new GenericApplicationContext(beanFactory);
    context.refresh();
    assertThat(context.getBeansOfType(RepositoryFactoryInformation.class).values().size(), is(1));

    DomainClassConverter converter = new DomainClassConverter(new DefaultConversionService());
    converter.setApplicationContext(context);
View Full Code Here

  @Test
  public void matchFailsIfNoDaoAvailable() throws Exception {

    GenericApplicationContext ctx = new GenericApplicationContext();
    ctx.refresh();
    converter.setApplicationContext(ctx);
    assertMatches(false);
  }

  @Test
View Full Code Here

  @Test
  public void discoversFactoryAndRepoFromParentApplicationContext() {

    ApplicationContext parent = initContextWithRepo();
    GenericApplicationContext context = new GenericApplicationContext(parent);
    context.refresh();

    when(service.canConvert(String.class, Long.class)).thenReturn(true);

    converter.setApplicationContext(context);
    assertThat(converter.matches(sourceDescriptor, targetDescriptor), is(true));
View Full Code Here

    DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
    factory.registerBeanDefinition("provider", builder.getBeanDefinition());

    GenericApplicationContext ctx = new GenericApplicationContext(factory);
    ctx.refresh();
    return ctx;
  }

  private static class User {
View Full Code Here

    public ApplicationContext enrichedContext() throws IOException {
        GenericApplicationContext that=new GenericApplicationContext(applicationContext);
        XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(that);
        reader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_XSD);
        reader.loadBeanDefinitions(new InputStreamResource(getContextXml()));
        that.refresh();
        return that;
    }


}
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

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.