diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateProperties.java index 642959797b..d98464d7be 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateProperties.java @@ -25,7 +25,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; * @author Dave Syer * @since 1.1.0 */ -@ConfigurationProperties(prefix = "spring.groovy.template", ignoreUnknownFields = false) +@ConfigurationProperties(prefix = "spring.groovy.template", ignoreUnknownFields = true) public class GroovyTemplateProperties extends AbstractViewResolverProperties { public static final String DEFAULT_PREFIX = "classpath:/templates/"; diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAutoConfigurationTests.java index 77af19352b..1813f226d6 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAutoConfigurationTests.java @@ -41,10 +41,12 @@ import org.springframework.web.servlet.View; import org.springframework.web.servlet.ViewResolver; import org.springframework.web.servlet.support.RequestContext; import org.springframework.web.servlet.view.groovy.GroovyMarkupConfig; +import org.springframework.web.servlet.view.groovy.GroovyMarkupConfigurer; import org.springframework.web.servlet.view.groovy.GroovyMarkupViewResolver; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.notNullValue; import static org.junit.Assert.assertThat; @@ -171,6 +173,13 @@ public class GroovyTemplateAutoConfigurationTests { assertThat(writer.toString(), containsString("Hello World")); } + @Test + public void customConfiguration() throws Exception { + registerAndRefreshContext("spring.groovy.template.configuration.auto-indent:true"); + assertThat(this.context.getBean(GroovyMarkupConfigurer.class).isAutoIndent(), + is(true)); + } + private void registerAndRefreshContext(String... env) { EnvironmentTestUtils.addEnvironment(this.context, env); this.context.register(GroovyTemplateAutoConfiguration.class);