Java 类org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration 实例源码

项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:EndpointWebMvcAutoConfigurationTests.java   
@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");
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:EndpointWebMvcAutoConfigurationTests.java   
@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");
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:SpringApplicationAdminJmxAutoConfigurationTests.java   
@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));
}
项目:spring-boot-concourse    文件:EndpointWebMvcAutoConfigurationTests.java   
@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");
}
项目:spring-boot-concourse    文件:EndpointWebMvcAutoConfigurationTests.java   
@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");
}
项目:spring-boot-concourse    文件:SpringApplicationAdminJmxAutoConfigurationTests.java   
@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));
}
项目:contestparser    文件:EndpointWebMvcAutoConfigurationTests.java   
@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();
}
项目:contestparser    文件:SpringApplicationAdminJmxAutoConfigurationTests.java   
@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);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:EndpointWebMvcAutoConfiguration.java   
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);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:AutoConfigurationReproTests.java   
@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");
}
项目:spring-boot-concourse    文件:EndpointWebMvcAutoConfiguration.java   
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);
}
项目:spring-boot-concourse    文件:AutoConfigurationReproTests.java   
@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");
}
项目:contestparser    文件:EndpointWebMvcAutoConfiguration.java   
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);
}
项目:contestparser    文件:AutoConfigurationReproTests.java   
@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"));
}