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


Java AnnotationConfigApplicationContext.close方法代码示例

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


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

示例1: test

import org.springframework.context.annotation.AnnotationConfigApplicationContext; //导入方法依赖的package包/类
@Test
public void test() {
  AnnotationConfigApplicationContext context =
      new AnnotationConfigApplicationContext(this.getClass().getPackage().getName());
  Bean bean = context.getBean(Bean.class);

  Assert.assertEquals("aValue", bean.resolver.resolveStringValue("${a}"));
  try {
    bean.resolver.resolveStringValue("${b}");
    Assert.fail("must throw exception");
  } catch (IllegalArgumentException e) {
    Assert.assertEquals("Could not resolve placeholder 'b' in string value \"${b}\"", e.getMessage());
  }

  context.close();
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:17,代码来源:TestLastPropertyPlaceholderConfigurer.java

示例2: testClientIsNotAuthCode

import org.springframework.context.annotation.AnnotationConfigApplicationContext; //导入方法依赖的package包/类
@Test
public void testClientIsNotAuthCode() {
	AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
	context.register(MinimalSecureNonWebApplication.class);
	TestPropertyValues.of("security.oauth2.client.clientId=client").applyTo(context);
	context.refresh();
	assertThat(countBeans(context, ClientCredentialsResourceDetails.class))
			.isEqualTo(1);
	context.close();
}
 
开发者ID:spring-projects,项目名称:spring-security-oauth2-boot,代码行数:11,代码来源:OAuth2AutoConfigurationTests.java

示例3: allowedNoProvider

import org.springframework.context.annotation.AnnotationConfigApplicationContext; //导入方法依赖的package包/类
@Test
public void allowedNoProvider(@Mocked ConsumerSchemaFactory consumerSchemaFactory) {
  AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
  context.getBeanFactory().registerSingleton(consumerSchemaFactory.getClass().getName(), consumerSchemaFactory);
  context.register(ConsumerProviderManager.class);
  // must not throw exception
  context.refresh();

  context.close();
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:11,代码来源:TestConsumerProviderManager.java

示例4: 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

示例5: main

import org.springframework.context.annotation.AnnotationConfigApplicationContext; //导入方法依赖的package包/类
public static void main(String[] args) {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(SolrApplicationConfig.class);
    ctx.refresh();
    System.out.println("Using Spring Framework Version: " + SpringVersion.getVersion());
    System.out.println("Solr Active Profile: " + ctx.getEnvironment().getActiveProfiles()[0]);
    SolrUI ui = ctx.getBean(SolrUI.class);
    if (doReIndex(args))
        ui.populate();
    else
        ui.init();
    ctx.close();
}
 
开发者ID:mintster,项目名称:nixmash-blog,代码行数:14,代码来源:SolrLauncher.java

示例6: main

import org.springframework.context.annotation.AnnotationConfigApplicationContext; //导入方法依赖的package包/类
/**
 * @param args
 */
public static void main(String[] args) {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ElConfig.class);
        ElConfig resourceService = context.getBean(ElConfig.class);
        resourceService.outputResource();
        context.close();
}
 
开发者ID:zhazhapan,项目名称:hello-spring,代码行数:10,代码来源:Main.java

示例7: testSpringAutoStartupFalse

import org.springframework.context.annotation.AnnotationConfigApplicationContext; //导入方法依赖的package包/类
@Test
public void testSpringAutoStartupFalse() throws InterruptedException {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(TestConfigAutoStartupFalse.class);
    ctx.start();

    try {
        Engine engine = ctx.getBean(Engine.class);

        assertFalse(engine.isRunning());
        assertFalse(engine.isError());
    } finally {
        ctx.close();
    }
}
 
开发者ID:softelnet,项目名称:sponge,代码行数:15,代码来源:SpringAutoStartupTest.java

示例8: main

import org.springframework.context.annotation.AnnotationConfigApplicationContext; //导入方法依赖的package包/类
public static void main(String[] args) {
	AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(
	                ConditionConfig.class);
	ListService listService = context.getBean(ListService.class);
	System.err.println(context.getEnvironment().getProperty("os.name") + "系统下的列表命令为:"
	                + listService.showListCmd());
	context.close();
}
 
开发者ID:zhazhapan,项目名称:hello-spring,代码行数:9,代码来源:Main.java

示例9: main

import org.springframework.context.annotation.AnnotationConfigApplicationContext; //导入方法依赖的package包/类
public static void main(String[] args) {
	AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ScopeConfig.class);
	DemoSingletonService s1 = context.getBean(DemoSingletonService.class);
	DemoSingletonService s2 = context.getBean(DemoSingletonService.class);
	DemoPrototypeService p1 = context.getBean(DemoPrototypeService.class);
	DemoPrototypeService p2 = context.getBean(DemoPrototypeService.class);

	System.out.println("s1与s2是否相等:" + s1.equals(s2));
	System.out.println("p1与p2是否相等:" + p1.equals(p2));

	context.close();
}
 
开发者ID:zhazhapan,项目名称:hello-spring,代码行数:13,代码来源:Main.java

示例10: both3

import org.springframework.context.annotation.AnnotationConfigApplicationContext; //导入方法依赖的package包/类
@Test
public void both3() throws Exception {
	AnnotationConfigApplicationContext context = load(Config.class,
		"security.basic.enabled:true", "security.oauth2.client.client-id");
	assertThat(context.containsBean("myBean"), equalTo(true));
	context.close();
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-dashboard,代码行数:8,代码来源:OnSecurityEnabledAndOAuth2EnabledTests.java

示例11: main

import org.springframework.context.annotation.AnnotationConfigApplicationContext; //导入方法依赖的package包/类
public static void main(String[] args) {
	AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(DiConfig.class);
	UseFunctionService useFunctionService = context.getBean(UseFunctionService.class);
	System.out.println(useFunctionService.sayHello("di"));
	context.close();
}
 
开发者ID:zhazhapan,项目名称:hello-spring,代码行数:7,代码来源:Main.java

示例12: main

import org.springframework.context.annotation.AnnotationConfigApplicationContext; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
	AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(
			HelloClientConfig.class);
	context.close();
}
 
开发者ID:jigsaw-projects,项目名称:jigsaw-payment,代码行数:6,代码来源:HelloClient.java

示例13: main

import org.springframework.context.annotation.AnnotationConfigApplicationContext; //导入方法依赖的package包/类
public static void main(String[] args) {
	AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(
	                TaskScheduleConfig.class);
	context.close();
}
 
开发者ID:zhazhapan,项目名称:hello-spring,代码行数:6,代码来源:Main.java

示例14: propertySecurityEnabled

import org.springframework.context.annotation.AnnotationConfigApplicationContext; //导入方法依赖的package包/类
@Test
public void propertySecurityEnabled() throws Exception {
	AnnotationConfigApplicationContext context = load(Config.class, "security.basic.enabled:true");
	assertThat(context.containsBean("myBean"), equalTo(false));
	context.close();
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-dashboard,代码行数:7,代码来源:OnSecurityEnabledAndOAuth2EnabledTests.java

示例15: main

import org.springframework.context.annotation.AnnotationConfigApplicationContext; //导入方法依赖的package包/类
public static void main(String[] args) {
	AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(EventConfig.class);
	DemoPublisher demoPublisher = context.getBean(DemoPublisher.class);
	demoPublisher.publish("hello application event");
	context.close();
}
 
开发者ID:zhazhapan,项目名称:hello-spring,代码行数:7,代码来源:Main.java


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