Package org.springframework.boot.context.embedded

Examples of org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext


    verify(containerFactory).setPort(9000);
  }

  @Test
  public void customizeWithContainerFactory() throws Exception {
    this.context = new AnnotationConfigEmbeddedWebApplicationContext();
    this.context.register(CustomContainerConfig.class,
        ServerPropertiesAutoConfiguration.class,
        PropertyPlaceholderAutoConfiguration.class);
    this.context.refresh();
    containerFactory = this.context
View Full Code Here


  }

  @Test
  public void customizeTomcatWithCustomizer() throws Exception {
    containerFactory = mock(TomcatEmbeddedServletContainerFactory.class);
    this.context = new AnnotationConfigEmbeddedWebApplicationContext();
    this.context.register(Config.class, CustomizeConfig.class,
        ServerPropertiesAutoConfiguration.class,
        PropertyPlaceholderAutoConfiguration.class);
    this.context.refresh();
    ServerProperties server = this.context.getBean(ServerProperties.class);
View Full Code Here

    verify(containerFactory).setPort(3000);
  }

  @Test
  public void testAccidentalMultipleServerPropertiesBeans() throws Exception {
    this.context = new AnnotationConfigEmbeddedWebApplicationContext();
    this.context.register(Config.class, MutiServerPropertiesBeanConfig.class,
        ServerPropertiesAutoConfiguration.class,
        PropertyPlaceholderAutoConfiguration.class);
    this.thrown.expect(ApplicationContextException.class);
    this.thrown.expectMessage("Multiple ServerProperties");
View Full Code Here

    }
  }

  @Test
  public void handerAdaptersCreated() throws Exception {
    this.context = new AnnotationConfigEmbeddedWebApplicationContext();
    this.context.register(Config.class, WebMvcAutoConfiguration.class,
        HttpMessageConvertersAutoConfiguration.class,
        PropertyPlaceholderAutoConfiguration.class);
    this.context.refresh();
    assertEquals(3, this.context.getBeanNamesForType(HandlerAdapter.class).length);
View Full Code Here

            .getMessageConverters());
  }

  @Test
  public void handerMappingsCreated() throws Exception {
    this.context = new AnnotationConfigEmbeddedWebApplicationContext();
    this.context.register(Config.class, WebMvcAutoConfiguration.class,
        HttpMessageConvertersAutoConfiguration.class,
        PropertyPlaceholderAutoConfiguration.class);
    this.context.refresh();
    assertEquals(6, this.context.getBeanNamesForType(HandlerMapping.class).length);
View Full Code Here

    assertEquals(6, this.context.getBeanNamesForType(HandlerMapping.class).length);
  }

  @Test
  public void resourceHandlerMapping() throws Exception {
    this.context = new AnnotationConfigEmbeddedWebApplicationContext();
    this.context.register(Config.class, WebMvcAutoConfiguration.class,
        HttpMessageConvertersAutoConfiguration.class,
        PropertyPlaceholderAutoConfiguration.class);
    this.context.refresh();
    Map<String, List<Resource>> mappingLocations = getMappingLocations();
View Full Code Here

        equalTo((Resource) new ClassPathResource("/META-INF/resources/webjars/")));
  }

  @Test
  public void resourceHandlerMappingOverrideWebjars() throws Exception {
    this.context = new AnnotationConfigEmbeddedWebApplicationContext();
    this.context.register(WebJars.class, Config.class, WebMvcAutoConfiguration.class,
        HttpMessageConvertersAutoConfiguration.class,
        PropertyPlaceholderAutoConfiguration.class);
    this.context.refresh();
    Map<String, List<Resource>> mappingLocations = getMappingLocations();
View Full Code Here

        equalTo((Resource) new ClassPathResource("/foo/")));
  }

  @Test
  public void resourceHandlerMappingOverrideAll() throws Exception {
    this.context = new AnnotationConfigEmbeddedWebApplicationContext();
    this.context.register(AllResources.class, Config.class,
        WebMvcAutoConfiguration.class,
        HttpMessageConvertersAutoConfiguration.class,
        PropertyPlaceholderAutoConfiguration.class);
    this.context.refresh();
View Full Code Here

        equalTo((Resource) new ClassPathResource("/foo/")));
  }

  @Test
  public void resourceHandlerMappingDisabled() throws Exception {
    this.context = new AnnotationConfigEmbeddedWebApplicationContext();
    EnvironmentTestUtils.addEnvironment(this.context,
        "spring.resources.add-mappings:false");
    this.context.register(Config.class, WebMvcAutoConfiguration.class,
        HttpMessageConvertersAutoConfiguration.class,
        PropertyPlaceholderAutoConfiguration.class);
View Full Code Here

    assertThat(mappingLocations.size(), equalTo(0));
  }

  @Test
  public void noLocaleResolver() throws Exception {
    this.context = new AnnotationConfigEmbeddedWebApplicationContext();
    this.context.register(AllResources.class, Config.class,
        WebMvcAutoConfiguration.class,
        HttpMessageConvertersAutoConfiguration.class,
        PropertyPlaceholderAutoConfiguration.class);
    this.context.refresh();
View Full Code Here

TOP

Related Classes of org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.