当前位置: 首页>>代码示例>>Java>>正文


Java AnnotationConfigApplicationContext.refresh方法代码示例

本文整理汇总了Java中org.springframework.context.annotation.AnnotationConfigApplicationContext.refresh方法的典型用法代码示例。如果您正苦于以下问题:Java AnnotationConfigApplicationContext.refresh方法的具体用法?Java AnnotationConfigApplicationContext.refresh怎么用?Java AnnotationConfigApplicationContext.refresh使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.context.annotation.AnnotationConfigApplicationContext的用法示例。


在下文中一共展示了AnnotationConfigApplicationContext.refresh方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: provideCollectorComponent_canSetStorageContainerName

import org.springframework.context.annotation.AnnotationConfigApplicationContext; //导入方法依赖的package包/类
@Test
public void provideCollectorComponent_canSetStorageContainerName() {

    String storageContainerName = "pashmak";

    context = new AnnotationConfigApplicationContext();
    addEnvironment(context, "zipkin.collector.eventhub.storageConnectionString:" + dummyEventHubConnectionString);
    addEnvironment(context, "zipkin.collector.eventhub.eventHubConnectionString:" + dummyStorageConnectionString );
    addEnvironment(context, "zipkin.collector.eventhub.storageContainerName:" + storageContainerName);
    context.register(PropertyPlaceholderAutoConfiguration.class,
            EventHubCollectorAutoConfiguration.class,
            InMemoryConfiguration.class);
    context.refresh();

    EventHubCollector collector = context.getBean(EventHubCollector.class);
    assertNotNull(collector);
    assertEquals(storageContainerName, collector.getStorageContainerName());
}
 
开发者ID:aliostad,项目名称:zipkin-collector-eventhub,代码行数:19,代码来源:EventHubCollectorAutoConfigurationTest.java

示例2: setUp

import org.springframework.context.annotation.AnnotationConfigApplicationContext; //导入方法依赖的package包/类
@Before
public void setUp() throws IOException {
    AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext();
    applicationContext.register(TarantoolConfiguration.class);
    DockerPort dockerPort = docker.containers()
            .container("tarantool")
            .port(3301);
    ImmutableMap<String, Object> env = ImmutableMap.of("tarantoolPort", dockerPort.getExternalPort());
    applicationContext.getEnvironment().getPropertySources()
            .addFirst(new MapPropertySource("rule", env));
    applicationContext.refresh();

    TarantoolClientOps bean = (TarantoolClientOps) applicationContext.getBean("tarantoolSyncOps");
    String eval = IOUtils.toString(RepositoryIntegrationTests.class.getResource("/init.lua"));
    bean.eval(eval);
    //
    userRepository = applicationContext.getBean(UserRepository.class);
    userRepository.deleteAll();

    logEntryRepository = applicationContext.getBean(LogEntryRepository.class);
    logEntryRepository.deleteAll();

    addressRepository = applicationContext.getBean(AddressRepository.class);
    addressRepository.deleteAll();
}
 
开发者ID:saladinkzn,项目名称:spring-data-tarantool,代码行数:26,代码来源:RepositoryIntegrationTests.java

示例3: provideCollectorComponent_canSetEventHubName

import org.springframework.context.annotation.AnnotationConfigApplicationContext; //导入方法依赖的package包/类
@Test
public void provideCollectorComponent_canSetEventHubName() {

    String eventHubName = "pashmak";

    context = new AnnotationConfigApplicationContext();
    addEnvironment(context, "zipkin.collector.eventhub.storageConnectionString:" + dummyEventHubConnectionString);
    addEnvironment(context, "zipkin.collector.eventhub.eventHubConnectionString:" + dummyStorageConnectionString );
    addEnvironment(context, "zipkin.collector.eventhub.eventHubName:" + eventHubName);
    context.register(PropertyPlaceholderAutoConfiguration.class,
            EventHubCollectorAutoConfiguration.class,
            InMemoryConfiguration.class);
    context.refresh();

    EventHubCollector collector = context.getBean(EventHubCollector.class);
    assertNotNull(collector);
    assertEquals(eventHubName, collector.getEventHubName());
}
 
开发者ID:aliostad,项目名称:zipkin-collector-eventhub,代码行数:19,代码来源:EventHubCollectorAutoConfigurationTest.java

示例4: provideCollectorComponent_canSetStorageBlobPrefix

import org.springframework.context.annotation.AnnotationConfigApplicationContext; //导入方法依赖的package包/类
@Test
public void provideCollectorComponent_canSetStorageBlobPrefix() {

    String storageBlobPrefix = "pashmak";

    context = new AnnotationConfigApplicationContext();
    addEnvironment(context, "zipkin.collector.eventhub.storageConnectionString:" + dummyEventHubConnectionString);
    addEnvironment(context, "zipkin.collector.eventhub.eventHubConnectionString:" + dummyStorageConnectionString );
    addEnvironment(context, "zipkin.collector.eventhub.storageBlobPrefix:" + storageBlobPrefix);
    context.register(PropertyPlaceholderAutoConfiguration.class,
            EventHubCollectorAutoConfiguration.class,
            InMemoryConfiguration.class);
    context.refresh();

    EventHubCollector collector = context.getBean(EventHubCollector.class);
    assertNotNull(collector);
    assertEquals(storageBlobPrefix, collector.getStorageBlobPrefix());
}
 
开发者ID:aliostad,项目名称:zipkin-collector-eventhub,代码行数:19,代码来源:EventHubCollectorAutoConfigurationTest.java

示例5: app2

import org.springframework.context.annotation.AnnotationConfigApplicationContext; //导入方法依赖的package包/类
/**
 * 通过编码方式注册配置类
 */

 @Test
 public void app2(){
    AnnotationConfigApplicationContext atc=new AnnotationConfigApplicationContext();
    atc.register(SpringConfiguration.class);//注册配置类
    atc.refresh();//记得刷新

    String king=(String)atc.getBean("king");
    PrinterUtils.printBefore();
    PrinterUtils.printILog(king);
}
 
开发者ID:tomoncle,项目名称:JavaStudy,代码行数:15,代码来源:App.java

示例6: main

import org.springframework.context.annotation.AnnotationConfigApplicationContext; //导入方法依赖的package包/类
public static void main(String[] args) {

		AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
		ctx.register(ApplicationConfig.class);
		ctx.refresh();
		System.out.println("Spring Framework Version: " + SpringVersion.getVersion());
		System.out.println("Spring Boot Version: " + SpringBootVersion.getVersion());
		JpaUI ui = ctx.getBean(JpaUI.class);
		ui.init();
		ctx.close();
	}
 
开发者ID:mintster,项目名称:nixmash-blog,代码行数:12,代码来源:JpaLauncher.java

示例7: main

import org.springframework.context.annotation.AnnotationConfigApplicationContext; //导入方法依赖的package包/类
public static void main(String[] args) {
	AnnotationConfigApplicationContext context =
			new AnnotationConfigApplicationContext();
			context.register(AppConfiguration.class);
			context.refresh();
	ReportGenerator generator = (ReportGenerator) context.getBean("generator1");
	generator.format();
}
 
开发者ID:PawelBogdan,项目名称:BecomeJavaHero,代码行数:9,代码来源:App.java

示例8: createApplicationContext

import org.springframework.context.annotation.AnnotationConfigApplicationContext; //导入方法依赖的package包/类
public static AnnotationConfigApplicationContext createApplicationContext(DockerComposeRule docker) {
    AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext();
    applicationContext.getEnvironment()
            .getPropertySources()
            .addFirst(new DockerComposePropertySource("docker-compose", docker));
    applicationContext.register(TarantoolConfiguration.class);
    applicationContext.refresh();
    return applicationContext;
}
 
开发者ID:saladinkzn,项目名称:spring-data-tarantool,代码行数:10,代码来源:DockerTarantoolIntegrationTest.java

示例9: configure

import org.springframework.context.annotation.AnnotationConfigApplicationContext; //导入方法依赖的package包/类
@Override
public void configure(ConfigurationContext ctx) {
    // Application context for autowiring.
    AnnotationConfigApplicationContext autowireCtx = new AnnotationConfigApplicationContext() {
        @Override
        public String toString() {
            return SpringInjectionService.class.getSimpleName() + "Context";
        }
    };

    // Expose services for autowiring.
    ConfigurableListableBeanFactory factory = autowireCtx.getBeanFactory();

    uniqueServices(ctx).forEach(service -> {
        factory.registerResolvableDependency(service.getClass(), service);

        for (Class<?> type : service.getClass().getInterfaces()) {
            factory.registerResolvableDependency(type, service);
        }
    });

    autowireCtx.refresh();

    autowireCtx.setParent(parentCtx);

    autowire = autowireCtx.getAutowireCapableBeanFactory();
}
 
开发者ID:hekate-io,项目名称:hekate,代码行数:28,代码来源:SpringInjectionService.java

示例10: load

import org.springframework.context.annotation.AnnotationConfigApplicationContext; //导入方法依赖的package包/类
private AnnotationConfigApplicationContext load(Class<?> config, String... env) {
	AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
	EnvironmentTestUtils.addEnvironment(context, env);
	context.register(config);
	context.refresh();
	return context;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-dashboard,代码行数:8,代码来源:OnSecurityEnabledAndOAuth2EnabledTests.java

示例11: alternativesLengthCanBeCustomized

import org.springframework.context.annotation.AnnotationConfigApplicationContext; //导入方法依赖的package包/类
@Test
public void alternativesLengthCanBeCustomized() {
	AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
	EnvironmentTestUtils.addEnvironment(context, "inception.labelsLocation:/remote");
	EnvironmentTestUtils.addEnvironment(context, "inception.alternativesLength:5");
	context.register(Conf.class);
	context.refresh();
	LabelImageProcessorProperties properties = context.getBean(LabelImageProcessorProperties.class);
	assertThat(properties.getAlternativesLength(), equalTo(5));
}
 
开发者ID:tzolov,项目名称:tensorflow-spring-cloud-stream-app-starters,代码行数:11,代码来源:LabelImageProcessorPropertiesTest.java

示例12: vocabularyLocationCanBeCustomized

import org.springframework.context.annotation.AnnotationConfigApplicationContext; //导入方法依赖的package包/类
@Test
public void vocabularyLocationCanBeCustomized() {
	AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
	EnvironmentTestUtils.addEnvironment(context, "inception.vocabularyLocation:/remote");
	context.register(Conf.class);
	context.refresh();
	TwitterSentimentProcessorProperties properties = context.getBean(TwitterSentimentProcessorProperties.class);
	assertThat(properties.getVocabularyLocation(), equalTo(context.getResource("/remote")));
}
 
开发者ID:tzolov,项目名称:tensorflow-spring-cloud-stream-app-starters,代码行数:10,代码来源:TwitterSentimentProcessorPropertiesTest.java

示例13: load

import org.springframework.context.annotation.AnnotationConfigApplicationContext; //导入方法依赖的package包/类
private void load(Class<?> config, String... environment) {
    AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext();
    applicationContext.register(config);
    applicationContext.register(QpidJMSAutoConfiguration.class, JmsAutoConfiguration.class);
    EnvironmentTestUtils.addEnvironment(applicationContext, environment);
    applicationContext.refresh();
    this.context = applicationContext;
}
 
开发者ID:tabish121,项目名称:qpid-jms-spring-boot,代码行数:9,代码来源:QpidJMSAutoConfigurationTest.java

示例14: load

import org.springframework.context.annotation.AnnotationConfigApplicationContext; //导入方法依赖的package包/类
private void load(Class<?> config, String... environment) {
    AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext();
    applicationContext.register(config);
    applicationContext.register(AMQP10JMSAutoConfiguration.class, JmsAutoConfiguration.class);
    EnvironmentTestUtils.addEnvironment(applicationContext, environment);
    applicationContext.refresh();
    this.context = applicationContext;
}
 
开发者ID:amqphub,项目名称:amqp-10-jms-spring-boot,代码行数:9,代码来源:AMQP10JMSAutoConfigurationTest.java

示例15: loadEnvironment

import org.springframework.context.annotation.AnnotationConfigApplicationContext; //导入方法依赖的package包/类
private void loadEnvironment(String... environment) {
	AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
	context.register(GcpContextAutoConfiguration.class);
	context.register(this.getClass());
	EnvironmentTestUtils.addEnvironment(context, environment);
	context.refresh();
	this.context = context;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-gcp,代码行数:9,代码来源:GcpContextAutoConfigurationTests.java


注:本文中的org.springframework.context.annotation.AnnotationConfigApplicationContext.refresh方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。