Java 类org.springframework.web.servlet.view.groovy.GroovyMarkupConfigurer 实例源码

项目:spring4-understanding    文件:ViewResolverRegistry.java   
/**
 * Register a Groovy markup view resolver with an empty default view name
 * prefix and a default suffix of ".tpl".
 */
public UrlBasedViewResolverRegistration groovy() {
    if (this.applicationContext != null && !hasBeanOfType(GroovyMarkupConfigurer.class)) {
        throw new BeanInitializationException("In addition to a Groovy markup view resolver " +
                "there must also be a single GroovyMarkupConfig bean in this web application context " +
                "(or its parent): GroovyMarkupConfigurer is the usual implementation. " +
                "This bean may be given any name.");
    }
    GroovyMarkupRegistration registration = new GroovyMarkupRegistration();
    this.viewResolvers.add(registration.getViewResolver());
    return registration;
}
项目:spring4-understanding    文件:ViewResolverRegistryTests.java   
@Before
public void setUp() {
    StaticWebApplicationContext context = new StaticWebApplicationContext();
    context.registerSingleton("freeMarkerConfigurer", FreeMarkerConfigurer.class);
    context.registerSingleton("velocityConfigurer", VelocityConfigurer.class);
    context.registerSingleton("tilesConfigurer", TilesConfigurer.class);
    context.registerSingleton("groovyMarkupConfigurer", GroovyMarkupConfigurer.class);
    context.registerSingleton("scriptTemplateConfigurer", ScriptTemplateConfigurer.class);
    this.registry = new ViewResolverRegistry();
    this.registry.setApplicationContext(context);
    this.registry.setContentNegotiationManager(new ContentNegotiationManager());
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:GroovyTemplateAutoConfiguration.java   
@Bean
@ConditionalOnMissingBean(GroovyMarkupConfig.class)
@ConfigurationProperties(prefix = "spring.groovy.template.configuration")
public GroovyMarkupConfigurer groovyMarkupConfigurer() {
    GroovyMarkupConfigurer configurer = new GroovyMarkupConfigurer();
    configurer.setResourceLoaderPath(this.properties.getResourceLoaderPath());
    configurer.setCacheTemplates(this.properties.isCache());
    if (this.templateEngine != null) {
        configurer.setTemplateEngine(this.templateEngine);
    }
    return configurer;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:GroovyTemplateAutoConfigurationTests.java   
@Test
public void customConfiguration() throws Exception {
    registerAndRefreshContext(
            "spring.groovy.template.configuration.auto-indent:true");
    assertThat(this.context.getBean(GroovyMarkupConfigurer.class).isAutoIndent())
            .isEqualTo(true);
}
项目:spring-boot-concourse    文件:GroovyTemplateAutoConfiguration.java   
@Bean
@ConditionalOnMissingBean(GroovyMarkupConfig.class)
@ConfigurationProperties(prefix = "spring.groovy.template.configuration")
public GroovyMarkupConfigurer groovyMarkupConfigurer() {
    GroovyMarkupConfigurer configurer = new GroovyMarkupConfigurer();
    configurer.setResourceLoaderPath(this.properties.getResourceLoaderPath());
    configurer.setCacheTemplates(this.properties.isCache());
    if (this.templateEngine != null) {
        configurer.setTemplateEngine(this.templateEngine);
    }
    return configurer;
}
项目:spring-boot-concourse    文件:GroovyTemplateAutoConfigurationTests.java   
@Test
public void customConfiguration() throws Exception {
    registerAndRefreshContext(
            "spring.groovy.template.configuration.auto-indent:true");
    assertThat(this.context.getBean(GroovyMarkupConfigurer.class).isAutoIndent())
            .isEqualTo(true);
}
项目:contestparser    文件:GroovyTemplateAutoConfiguration.java   
@Bean
@ConditionalOnMissingBean(GroovyMarkupConfig.class)
@ConfigurationProperties(prefix = "spring.groovy.template.configuration")
public GroovyMarkupConfigurer groovyMarkupConfigurer() {
    GroovyMarkupConfigurer configurer = new GroovyMarkupConfigurer();
    configurer.setResourceLoaderPath(this.properties.getResourceLoaderPath());
    configurer.setCacheTemplates(this.properties.isCache());
    if (this.templateEngine != null) {
        configurer.setTemplateEngine(this.templateEngine);
    }
    return configurer;
}
项目:contestparser    文件:GroovyTemplateAutoConfigurationTests.java   
@Test
public void customConfiguration() throws Exception {
    registerAndRefreshContext(
            "spring.groovy.template.configuration.auto-indent:true");
    assertThat(this.context.getBean(GroovyMarkupConfigurer.class).isAutoIndent(),
            is(true));
}
项目:spring4-understanding    文件:ViewResolutionIntegrationTests.java   
@Bean
public GroovyMarkupConfigurer groovyMarkupConfigurer() {
    GroovyMarkupConfigurer configurer = new GroovyMarkupConfigurer();
    configurer.setResourceLoaderPath("/WEB-INF/");
    return configurer;
}