本文整理匯總了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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例13: main
import org.springframework.context.annotation.AnnotationConfigApplicationContext; //導入方法依賴的package包/類
public static void main(String[] args) {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(
TaskScheduleConfig.class);
context.close();
}
示例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();
}