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


Java EmbeddedServletContainerAutoConfiguration类代码示例

本文整理汇总了Java中org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration的典型用法代码示例。如果您正苦于以下问题:Java EmbeddedServletContainerAutoConfiguration类的具体用法?Java EmbeddedServletContainerAutoConfiguration怎么用?Java EmbeddedServletContainerAutoConfiguration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


EmbeddedServletContainerAutoConfiguration类属于org.springframework.boot.autoconfigure.web包,在下文中一共展示了EmbeddedServletContainerAutoConfiguration类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: contextPath

import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration; //导入依赖的package包/类
@Test
public void contextPath() throws Exception {
	EnvironmentTestUtils.addEnvironment(this.applicationContext,
			"management.contextPath:/test");
	this.applicationContext.register(RootConfig.class, EndpointConfig.class,
			ServerPortConfig.class, PropertyPlaceholderAutoConfiguration.class,
			ManagementServerPropertiesAutoConfiguration.class,
			ServerPropertiesAutoConfiguration.class, JacksonAutoConfiguration.class,
			EmbeddedServletContainerAutoConfiguration.class,
			HttpMessageConvertersAutoConfiguration.class,
			DispatcherServletAutoConfiguration.class, WebMvcAutoConfiguration.class,
			EndpointWebMvcAutoConfiguration.class);
	this.applicationContext.refresh();
	assertContent("/controller", ports.get().server, "controlleroutput");
	assertContent("/test/endpoint", ports.get().server, "endpointoutput");
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:17,代码来源:EndpointWebMvcAutoConfigurationTests.java

示例2: overrideServerProperties

import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration; //导入依赖的package包/类
@Test
public void overrideServerProperties() throws Exception {
	EnvironmentTestUtils.addEnvironment(this.applicationContext,
			"server.displayName:foo");
	this.applicationContext.register(RootConfig.class, EndpointConfig.class,
			ServerPortConfig.class, PropertyPlaceholderAutoConfiguration.class,
			ManagementServerPropertiesAutoConfiguration.class,
			ServerPropertiesAutoConfiguration.class, JacksonAutoConfiguration.class,
			EmbeddedServletContainerAutoConfiguration.class,
			HttpMessageConvertersAutoConfiguration.class,
			DispatcherServletAutoConfiguration.class, WebMvcAutoConfiguration.class,
			EndpointWebMvcAutoConfiguration.class);
	this.applicationContext.refresh();
	assertContent("/controller", ports.get().server, "controlleroutput");
	ServerProperties serverProperties = this.applicationContext
			.getBean(ServerProperties.class);
	assertThat(serverProperties.getDisplayName()).isEqualTo("foo");
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:19,代码来源:EndpointWebMvcAutoConfigurationTests.java

示例3: registerWithSimpleWebApp

import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration; //导入依赖的package包/类
@Test
public void registerWithSimpleWebApp() throws Exception {
	this.context = new SpringApplicationBuilder()
			.sources(EmbeddedServletContainerAutoConfiguration.class,
					ServerPropertiesAutoConfiguration.class,
					DispatcherServletAutoConfiguration.class,
					JmxAutoConfiguration.class,
					SpringApplicationAdminJmxAutoConfiguration.class)
			.run("--" + ENABLE_ADMIN_PROP, "--server.port=0");
	assertThat(this.context).isInstanceOf(EmbeddedWebApplicationContext.class);
	assertThat(this.mBeanServer.getAttribute(createDefaultObjectName(),
			"EmbeddedWebApplication")).isEqualTo(Boolean.TRUE);
	int expected = ((EmbeddedWebApplicationContext) this.context)
			.getEmbeddedServletContainer().getPort();
	String actual = getProperty(createDefaultObjectName(), "local.server.port");
	assertThat(actual).isEqualTo(String.valueOf(expected));
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:18,代码来源:SpringApplicationAdminJmxAutoConfigurationTests.java

示例4: contextPath

import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration; //导入依赖的package包/类
@Test
public void contextPath() throws Exception {
	EnvironmentTestUtils.addEnvironment(this.applicationContext,
			"management.contextPath:/test");
	this.applicationContext.register(RootConfig.class, EndpointConfig.class,
			ServerPortConfig.class, PropertyPlaceholderAutoConfiguration.class,
			ManagementServerPropertiesAutoConfiguration.class,
			ServerPropertiesAutoConfiguration.class, JacksonAutoConfiguration.class,
			EmbeddedServletContainerAutoConfiguration.class,
			HttpMessageConvertersAutoConfiguration.class,
			DispatcherServletAutoConfiguration.class, WebMvcAutoConfiguration.class,
			EndpointWebMvcAutoConfiguration.class);
	this.applicationContext.refresh();
	assertContent("/controller", ports.get().server, "controlleroutput");
	assertContent("/test/endpoint", ports.get().server, "endpointoutput");
	this.applicationContext.close();
	assertAllClosed();
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:19,代码来源:EndpointWebMvcAutoConfigurationTests.java

示例5: registerWithSimpleWebApp

import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration; //导入依赖的package包/类
@Test
public void registerWithSimpleWebApp() throws Exception {
	this.context = new SpringApplicationBuilder()
			.sources(EmbeddedServletContainerAutoConfiguration.class,
					ServerPropertiesAutoConfiguration.class,
					DispatcherServletAutoConfiguration.class,
					JmxAutoConfiguration.class,
					SpringApplicationAdminJmxAutoConfiguration.class)
			.run("--" + ENABLE_ADMIN_PROP, "--server.port=0");
	assertTrue(this.context instanceof EmbeddedWebApplicationContext);
	assertEquals(true, this.mBeanServer.getAttribute(createDefaultObjectName(),
			"EmbeddedWebApplication"));
	int expected = ((EmbeddedWebApplicationContext) this.context)
			.getEmbeddedServletContainer().getPort();
	String actual = getProperty(createDefaultObjectName(), "local.server.port");
	assertEquals(String.valueOf(expected), actual);
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:18,代码来源:SpringApplicationAdminJmxAutoConfigurationTests.java

示例6: createChildManagementContext

import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration; //导入依赖的package包/类
private void createChildManagementContext() {
	AnnotationConfigEmbeddedWebApplicationContext childContext = new AnnotationConfigEmbeddedWebApplicationContext();
	childContext.setParent(this.applicationContext);
	childContext.setNamespace("management");
	childContext.setId(this.applicationContext.getId() + ":management");
	childContext.register(EndpointWebMvcChildContextConfiguration.class,
			PropertyPlaceholderAutoConfiguration.class,
			EmbeddedServletContainerAutoConfiguration.class,
			DispatcherServletAutoConfiguration.class);
	registerEmbeddedServletContainerFactory(childContext);
	CloseManagementContextListener.addIfPossible(this.applicationContext,
			childContext);
	childContext.refresh();
	managementContextResolver().setApplicationContext(childContext);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:16,代码来源:EndpointWebMvcAutoConfiguration.java

示例7: doesNotEarlyInitializeFactoryBeans

import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration; //导入依赖的package包/类
@Test
public void doesNotEarlyInitializeFactoryBeans() throws Exception {
	SpringApplication application = new SpringApplication(EarlyInitConfig.class,
			PropertySourcesPlaceholderConfigurer.class,
			EmbeddedServletContainerAutoConfiguration.class,
			ServerPropertiesAutoConfiguration.class);
	this.context = application.run("--server.port=0");
	String bean = (String) this.context.getBean("earlyInit");
	assertThat(bean).isEqualTo("bucket");
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:11,代码来源:AutoConfigurationReproTests.java

示例8: createChildManagementContext

import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration; //导入依赖的package包/类
private void createChildManagementContext() {
	final AnnotationConfigEmbeddedWebApplicationContext childContext = new AnnotationConfigEmbeddedWebApplicationContext();
	childContext.setParent(this.applicationContext);
	childContext.setNamespace("management");
	childContext.setId(this.applicationContext.getId() + ":management");
	childContext.register(EndpointWebMvcChildContextConfiguration.class,
			PropertyPlaceholderAutoConfiguration.class,
			EmbeddedServletContainerAutoConfiguration.class,
			DispatcherServletAutoConfiguration.class);
	CloseEventPropagationListener.addIfPossible(this.applicationContext,
			childContext);
	childContext.refresh();
	managementContextResolver().setApplicationContext(childContext);
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:15,代码来源:EndpointWebMvcAutoConfiguration.java

示例9: doesNotEarlyInitializeFactoryBeans

import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration; //导入依赖的package包/类
@Test
public void doesNotEarlyInitializeFactoryBeans() throws Exception {
	SpringApplication application = new SpringApplication(EarlyInitConfig.class,
			PropertySourcesPlaceholderConfigurer.class,
			EmbeddedServletContainerAutoConfiguration.class,
			ServerPropertiesAutoConfiguration.class);
	this.context = application.run("--server.port=0");
	String bean = (String) this.context.getBean("earlyInit");
	assertThat(bean, equalTo("bucket"));
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:11,代码来源:AutoConfigurationReproTests.java


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