Add spring.*.enabled for MVC view resolvers
Since we use a composite ViewResolver glbally by default it can be awkward to switch off the view technology that you have on the classpath but aren't actually using.
This commit is contained in:
@@ -38,6 +38,7 @@ import org.springframework.mock.web.MockHttpServletResponse;
|
||||
import org.springframework.mock.web.MockServletContext;
|
||||
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
|
||||
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.GroovyMarkupViewResolver;
|
||||
@@ -100,6 +101,15 @@ public class GroovyTemplateAutoConfigurationTests {
|
||||
assertThat(response.getContentType(), equalTo("text/html;charset=UTF-8"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void disableViewResolution() throws Exception {
|
||||
EnvironmentTestUtils.addEnvironment(this.context,
|
||||
"spring.groovy.template.enabled:false");
|
||||
registerAndRefreshContext();
|
||||
assertThat(this.context.getBeanNamesForType(ViewResolver.class).length,
|
||||
equalTo(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void localeViewResolution() throws Exception {
|
||||
registerAndRefreshContext();
|
||||
|
||||
Reference in New Issue
Block a user