本文整理匯總了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();
}
示例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);
}
示例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();
}
示例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();
}
示例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;
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}