當前位置: 首頁>>代碼示例>>Java>>正文


Java AnnotationConfigWebApplicationContext.close方法代碼示例

本文整理匯總了Java中org.springframework.web.context.support.AnnotationConfigWebApplicationContext.close方法的典型用法代碼示例。如果您正苦於以下問題:Java AnnotationConfigWebApplicationContext.close方法的具體用法?Java AnnotationConfigWebApplicationContext.close怎麽用?Java AnnotationConfigWebApplicationContext.close使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.web.context.support.AnnotationConfigWebApplicationContext的用法示例。


在下文中一共展示了AnnotationConfigWebApplicationContext.close方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getToolContext

import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; //導入方法依賴的package包/類
private ToolContext getToolContext(String toolboxConfigLocation) throws Exception {
	AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
	context.setServletContext(new MockServletContext());
	context.register(Config.class);
	context.refresh();
	EmbeddedVelocityToolboxView view = context
			.getBean(EmbeddedVelocityToolboxView.class);
	view.setToolboxConfigLocation(toolboxConfigLocation);
	Map<String, Object> model = new LinkedHashMap<String, Object>();
	HttpServletRequest request = new MockHttpServletRequest();
	HttpServletResponse response = new MockHttpServletResponse();
	ToolContext toolContext = (ToolContext) view.createVelocityContext(model, request,
			response);
	context.close();
	return toolContext;
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:17,代碼來源:EmbeddedVelocityToolboxViewTests.java

示例2: createLayoutFromConfigClass

import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; //導入方法依賴的package包/類
@Test
public void createLayoutFromConfigClass() throws Exception {
	AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
	context.register(ThymeleafAutoConfiguration.class,
			PropertyPlaceholderAutoConfiguration.class);
	MockServletContext servletContext = new MockServletContext();
	context.setServletContext(servletContext);
	context.refresh();
	ThymeleafView view = (ThymeleafView) context.getBean(ThymeleafViewResolver.class)
			.resolveViewName("view", Locale.UK);
	MockHttpServletResponse response = new MockHttpServletResponse();
	MockHttpServletRequest request = new MockHttpServletRequest();
	request.setAttribute(RequestContext.WEB_APPLICATION_CONTEXT_ATTRIBUTE, context);
	view.render(Collections.singletonMap("foo", "bar"), request, response);
	String result = response.getContentAsString();
	assertThat(result).contains("<title>Content</title>");
	assertThat(result).contains("<span>bar</span>");
	context.close();
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:20,代碼來源:ThymeleafAutoConfigurationTests.java

示例3: testCustomShellProperties

import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; //導入方法依賴的package包/類
@Test
public void testCustomShellProperties() throws Exception {
	MockEnvironment env = new MockEnvironment();
	env.setProperty("management.shell.auth.type", "simple");
	AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();
	ctx.setEnvironment(env);
	ctx.setServletContext(new MockServletContext());
	ctx.register(TestShellConfiguration.class);
	ctx.register(CrshAutoConfiguration.class);
	ctx.refresh();

	PluginLifeCycle lifeCycle = ctx.getBean(PluginLifeCycle.class);
	String uuid = lifeCycle.getConfig().getProperty("test.uuid");
	assertThat(uuid).isEqualTo(TestShellConfiguration.uuid);
	ctx.close();
}
 
開發者ID:philwebb,項目名稱:spring-boot-concourse,代碼行數:17,代碼來源:ShellPropertiesTests.java

示例4: testOpenEntityManagerInViewInterceptorNotRegisteredWhenExplicitlyOff

import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; //導入方法依賴的package包/類
@Test
public void testOpenEntityManagerInViewInterceptorNotRegisteredWhenExplicitlyOff()
		throws Exception {
	AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
	EnvironmentTestUtils.addEnvironment(context, "spring.jpa.open_in_view:false");
	context.register(TestConfiguration.class, EmbeddedDataSourceConfiguration.class,
			PropertyPlaceholderAutoConfiguration.class, getAutoConfigureClass());
	context.refresh();
	assertThat(getInterceptorBeans(context).length).isEqualTo(0);
	context.close();
}
 
開發者ID:philwebb,項目名稱:spring-boot-concourse,代碼行數:12,代碼來源:AbstractJpaAutoConfigurationTests.java

示例5: filterAutoConfigurationWorksWithoutSecurityAutoConfiguration

import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; //導入方法依賴的package包/類
@Test
public void filterAutoConfigurationWorksWithoutSecurityAutoConfiguration()
		throws Exception {
	AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
	context.setServletContext(new MockServletContext());
	try {
		context.register(Config.class);
		context.refresh();
	}
	finally {
		context.close();
	}

}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:15,代碼來源:SecurityFilterAutoConfigurationTests.java

示例6: testOpenEntityManagerInViewInterceptorCreated

import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; //導入方法依賴的package包/類
@Test
public void testOpenEntityManagerInViewInterceptorCreated() throws Exception {
	AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
	context.register(TestConfiguration.class, EmbeddedDataSourceConfiguration.class,
			PropertyPlaceholderAutoConfiguration.class, getAutoConfigureClass());
	context.refresh();
	assertThat(context.getBean(OpenEntityManagerInViewInterceptor.class)).isNotNull();
	context.close();
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:10,代碼來源:AbstractJpaAutoConfigurationTests.java

示例7: testOpenEntityManagerInViewInterceptorNotRegisteredWhenFilterPresent

import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; //導入方法依賴的package包/類
@Test
public void testOpenEntityManagerInViewInterceptorNotRegisteredWhenFilterPresent()
		throws Exception {
	AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
	context.register(TestFilterConfiguration.class,
			EmbeddedDataSourceConfiguration.class,
			PropertyPlaceholderAutoConfiguration.class, getAutoConfigureClass());
	context.refresh();
	assertThat(getInterceptorBeans(context).length).isEqualTo(0);
	context.close();
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:12,代碼來源:AbstractJpaAutoConfigurationTests.java

示例8: contextLoads

import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; //導入方法依賴的package包/類
@Test
public void contextLoads() {
	AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
	context.register(TestConfig.class);
	context.setServletContext(new MockServletContext());
	context.refresh();

	MatcherAssert.assertThat(context.getBean("contentHandlerMapping"), CoreMatchers.is(CoreMatchers.not(CoreMatchers.nullValue())));
	MatcherAssert.assertThat(context.getBean("contentLinksProcessor"), CoreMatchers.is(CoreMatchers.not(CoreMatchers.nullValue())));

	context.close();
}
 
開發者ID:paulcwarren,項目名稱:spring-content,代碼行數:13,代碼來源:ContentRestAutoConfigurationTests.java

示例9: contextDestroyed

import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; //導入方法依賴的package包/類
@Override
public void contextDestroyed(ServletContextEvent sce) {
    LOGGER.info("Destroying Web application");
    WebApplicationContext ac = WebApplicationContextUtils.getRequiredWebApplicationContext(sce.getServletContext());
    AnnotationConfigWebApplicationContext gwac = (AnnotationConfigWebApplicationContext) ac;
    gwac.close();
    LOGGER.debug("Web application destroyed");
}
 
開發者ID:flowable,項目名稱:flowable-engine,代碼行數:9,代碼來源:WebConfigurer.java


注:本文中的org.springframework.web.context.support.AnnotationConfigWebApplicationContext.close方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。