Merge branch '1.2.x'

pull/3211/head
Andy Wilkinson 10 years ago
commit 6e79677df8

@ -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/";

@ -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);

Loading…
Cancel
Save