Java 类org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration 实例源码

项目:spring-boot-concourse    文件:DeviceDelegatingViewResolverAutoConfigurationTests.java   
@Test
public void deviceDelegatingThymeleafViewResolverEnabled() throws Exception {
    this.context = new AnnotationConfigEmbeddedWebApplicationContext();
    EnvironmentTestUtils.addEnvironment(this.context,
            "spring.mobile.devicedelegatingviewresolver.enabled:true");
    this.context.register(Config.class, WebMvcAutoConfiguration.class,
            ThymeleafAutoConfiguration.class,
            HttpMessageConvertersAutoConfiguration.class,
            PropertyPlaceholderAutoConfiguration.class,
            DeviceDelegatingViewResolverConfiguration.class);
    this.context.refresh();
    ThymeleafViewResolver thymeleafViewResolver = this.context
            .getBean(ThymeleafViewResolver.class);
    AbstractDeviceDelegatingViewResolver deviceDelegatingViewResolver = this.context
            .getBean("deviceDelegatingViewResolver",
                    AbstractDeviceDelegatingViewResolver.class);
    assertThat(thymeleafViewResolver).isNotNull();
    assertThat(deviceDelegatingViewResolver).isNotNull();
    assertThat(deviceDelegatingViewResolver.getViewResolver())
            .isInstanceOf(ThymeleafViewResolver.class);
    assertThat(this.context.getBean(InternalResourceViewResolver.class)).isNotNull();
    assertThat(this.context.getBean(ThymeleafViewResolver.class)).isNotNull();
    assertThat(deviceDelegatingViewResolver.getOrder())
            .isEqualTo(thymeleafViewResolver.getOrder() - 1);
}
项目:spring-boot-concourse    文件:DeviceDelegatingViewResolverAutoConfigurationTests.java   
@Test(expected = NoSuchBeanDefinitionException.class)
public void deviceDelegatingThymeleafViewResolverDisabled() throws Exception {
    this.context = new AnnotationConfigEmbeddedWebApplicationContext();
    EnvironmentTestUtils.addEnvironment(this.context,
            "spring.mobile.devicedelegatingviewresolver.enabled:false");
    this.context.register(Config.class, WebMvcAutoConfiguration.class,
            ThymeleafAutoConfiguration.class,
            HttpMessageConvertersAutoConfiguration.class,
            PropertyPlaceholderAutoConfiguration.class,
            DeviceDelegatingViewResolverConfiguration.class);
    this.context.refresh();
    assertThat(this.context.getBean(InternalResourceViewResolver.class)).isNotNull();
    assertThat(this.context.getBean(ThymeleafViewResolver.class)).isNotNull();
    this.context.getBean("deviceDelegatingViewResolver",
            AbstractDeviceDelegatingViewResolver.class);
}
项目:contestparser    文件:DeviceDelegatingViewResolverAutoConfigurationTests.java   
@Test
public void deviceDelegatingThymeleafViewResolverEnabled() throws Exception {
    this.context = new AnnotationConfigEmbeddedWebApplicationContext();
    EnvironmentTestUtils.addEnvironment(this.context,
            "spring.mobile.devicedelegatingviewresolver.enabled:true");
    this.context.register(Config.class, WebMvcAutoConfiguration.class,
            ThymeleafAutoConfiguration.class,
            HttpMessageConvertersAutoConfiguration.class,
            PropertyPlaceholderAutoConfiguration.class,
            DeviceDelegatingViewResolverConfiguration.class);
    this.context.refresh();
    ThymeleafViewResolver thymeleafViewResolver = this.context
            .getBean(ThymeleafViewResolver.class);
    AbstractDeviceDelegatingViewResolver deviceDelegatingViewResolver = this.context
            .getBean("deviceDelegatingViewResolver",
                    AbstractDeviceDelegatingViewResolver.class);
    assertNotNull(thymeleafViewResolver);
    assertNotNull(deviceDelegatingViewResolver);
    assertTrue(deviceDelegatingViewResolver
            .getViewResolver() instanceof ThymeleafViewResolver);
    assertNotNull(this.context.getBean(InternalResourceViewResolver.class));
    assertNotNull(this.context.getBean(ThymeleafViewResolver.class));
    assertTrue(deviceDelegatingViewResolver
            .getOrder() == thymeleafViewResolver.getOrder() - 1);
}
项目:contestparser    文件:DeviceDelegatingViewResolverAutoConfigurationTests.java   
@Test(expected = NoSuchBeanDefinitionException.class)
public void deviceDelegatingThymeleafViewResolverDisabled() throws Exception {
    this.context = new AnnotationConfigEmbeddedWebApplicationContext();
    EnvironmentTestUtils.addEnvironment(this.context,
            "spring.mobile.devicedelegatingviewresolver.enabled:false");
    this.context.register(Config.class, WebMvcAutoConfiguration.class,
            ThymeleafAutoConfiguration.class,
            HttpMessageConvertersAutoConfiguration.class,
            PropertyPlaceholderAutoConfiguration.class,
            DeviceDelegatingViewResolverConfiguration.class);
    this.context.refresh();
    assertNotNull(this.context.getBean(InternalResourceViewResolver.class));
    assertNotNull(this.context.getBean(ThymeleafViewResolver.class));
    this.context.getBean("deviceDelegatingViewResolver",
            AbstractDeviceDelegatingViewResolver.class);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ImportAutoConfigurationImportSelectorTests.java   
@Test
public void multipleImportsAreFound() throws Exception {
    AnnotationMetadata annotationMetadata = new SimpleMetadataReaderFactory()
            .getMetadataReader(MultipleImports.class.getName())
            .getAnnotationMetadata();
    String[] imports = this.importSelector.selectImports(annotationMetadata);
    assertThat(imports).containsOnly(FreeMarkerAutoConfiguration.class.getName(),
            ThymeleafAutoConfiguration.class.getName());
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ImportAutoConfigurationImportSelectorTests.java   
@Test
public void selfAnnotatingAnnotationDoesNotCauseStackOverflow() throws IOException {
    AnnotationMetadata annotationMetadata = new SimpleMetadataReaderFactory()
            .getMetadataReader(ImportWithSelfAnnotatingAnnotation.class.getName())
            .getAnnotationMetadata();
    String[] imports = this.importSelector.selectImports(annotationMetadata);
    assertThat(imports).containsOnly(ThymeleafAutoConfiguration.class.getName());
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:DeviceDelegatingViewResolverAutoConfigurationTests.java   
@Test
public void deviceDelegatingThymeleafViewResolver() throws Exception {
    load(Collections.<Class<?>>singletonList(ThymeleafAutoConfiguration.class),
            "spring.mobile.devicedelegatingviewresolver.enabled:true");
    assertThat(this.context.getBeansOfType(LiteDeviceDelegatingViewResolver.class))
            .hasSize(2);
    assertLiteDeviceDelegatingViewResolver(
            this.context.getBean(ThymeleafViewResolver.class),
            "deviceDelegatingThymeleafViewResolver");
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:DeviceDelegatingViewResolverAutoConfigurationTests.java   
@Test
public void deviceDelegatingViewResolverDisabled() throws Exception {
    load(Arrays.asList(FreeMarkerAutoConfiguration.class,
            GroovyTemplateAutoConfiguration.class, MustacheAutoConfiguration.class,
            ThymeleafAutoConfiguration.class),
            "spring.mobile.devicedelegatingviewresolver.enabled:false");
    assertThat(this.context.getBeansOfType(LiteDeviceDelegatingViewResolver.class))
            .hasSize(0);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:EnableAutoConfigurationImportSelectorTests.java   
@Test
public void combinedExclusionsAreApplied() {
    configureExclusions(new String[] { VelocityAutoConfiguration.class.getName() },
            new String[] { FreeMarkerAutoConfiguration.class.getName() },
            new String[] { ThymeleafAutoConfiguration.class.getName() });
    String[] imports = this.importSelector.selectImports(this.annotationMetadata);
    assertThat(imports).hasSize(getAutoConfigurationClassNames().size() - 3);
    assertThat(ConditionEvaluationReport.get(this.beanFactory).getExclusions())
            .contains(FreeMarkerAutoConfiguration.class.getName(),
                    VelocityAutoConfiguration.class.getName(),
                    ThymeleafAutoConfiguration.class.getName());
}
项目:spring-boot-concourse    文件:ImportAutoConfigurationImportSelectorTests.java   
@Test
public void multipleImportsAreFound() throws Exception {
    AnnotationMetadata annotationMetadata = new SimpleMetadataReaderFactory()
            .getMetadataReader(MultipleImports.class.getName())
            .getAnnotationMetadata();
    String[] imports = this.importSelector.selectImports(annotationMetadata);
    assertThat(imports).containsOnly(FreeMarkerAutoConfiguration.class.getName(),
            ThymeleafAutoConfiguration.class.getName());
}
项目:spring-boot-concourse    文件:ImportAutoConfigurationImportSelectorTests.java   
@Test
public void selfAnnotatingAnnotationDoesNotCauseStackOverflow() throws IOException {
    AnnotationMetadata annotationMetadata = new SimpleMetadataReaderFactory()
            .getMetadataReader(ImportWithSelfAnnotatingAnnotation.class.getName())
            .getAnnotationMetadata();
    String[] imports = this.importSelector.selectImports(annotationMetadata);
    assertThat(imports).containsOnly(ThymeleafAutoConfiguration.class.getName());
}
项目:spring-boot-concourse    文件:EnableAutoConfigurationImportSelectorTests.java   
@Test
public void combinedExclusionsAreApplied() {
    configureExclusions(new String[] { VelocityAutoConfiguration.class.getName() },
            new String[] { FreeMarkerAutoConfiguration.class.getName() },
            new String[] { ThymeleafAutoConfiguration.class.getName() });
    String[] imports = this.importSelector.selectImports(this.annotationMetadata);
    assertThat(imports).hasSize(getAutoConfigurationClassNames().size() - 3);
    assertThat(ConditionEvaluationReport.get(this.beanFactory).getExclusions())
            .contains(FreeMarkerAutoConfiguration.class.getName(),
                    VelocityAutoConfiguration.class.getName(),
                    ThymeleafAutoConfiguration.class.getName());
}
项目:contestparser    文件:EnableAutoConfigurationImportSelectorTests.java   
@Test
public void combinedExclusionsAreApplied() {
    configureExclusions(new String[] { VelocityAutoConfiguration.class.getName() },
            new String[] { FreeMarkerAutoConfiguration.class.getName() },
            new String[] { ThymeleafAutoConfiguration.class.getName() });
    String[] imports = this.importSelector.selectImports(this.annotationMetadata);
    assertThat(imports.length,
            is(equalTo(getAutoConfigurationClassNames().size() - 3)));
    assertThat(ConditionEvaluationReport.get(this.beanFactory).getExclusions(),
            containsInAnyOrder(FreeMarkerAutoConfiguration.class.getName(),
                    VelocityAutoConfiguration.class.getName(),
                    ThymeleafAutoConfiguration.class.getName()));
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:WebMvcTestAutoConfigurationIntegrationTests.java   
@Test
public void thymeleafAutoConfigurationWasImported() {
    assertThat(this.applicationContext)
            .has(importedAutoConfiguration(ThymeleafAutoConfiguration.class));
}
项目:spring-boot-concourse    文件:WebMvcTestAutoConfigurationIntegrationTests.java   
@Test
public void thymeleafAutoConfigurationWasImported() {
    assertThat(this.applicationContext)
            .has(importedAutoConfiguration(ThymeleafAutoConfiguration.class));
}