Allow HttpPutFormContentFilter to be disabled

Add `spring.mvc.formcontent.putfilter.enabled` property to allow the
HttpPutFormContentFilter to be disabled.

Fixes gh-6519
pull/7002/head
Phillip Webb 8 years ago
parent a2e4127d4f
commit b97e0bd471

@ -122,6 +122,7 @@ public class WebMvcAutoConfiguration {
@Bean
@ConditionalOnMissingBean(HttpPutFormContentFilter.class)
@ConditionalOnProperty(prefix = "spring.mvc.formcontent.putfilter", name = "enabled", matchIfMissing = true)
public OrderedHttpPutFormContentFilter httpPutFormContentFilter() {
return new OrderedHttpPutFormContentFilter();
}

@ -148,6 +148,12 @@
"description": "Enable resolution of favicon.ico.",
"defaultValue": true
},
{
"name": "spring.mvc.formcontent.putfilter.enabled",
"type": "java.lang.Boolean",
"description": "Enable Spring's HttpPutFormContentFilter.",
"defaultValue": true
},
{
"name": "spring.rabbitmq.dynamic",
"type": "java.lang.Boolean",

@ -476,6 +476,13 @@ public class WebMvcAutoConfigurationTests {
is(equalTo(1)));
}
@Test
public void httpPutFormContentFilterCanBeDisabled() throws Exception {
load((Class<?>) null, "spring.mvc.formcontent.putfilter.enabled=false");
assertThat(this.context.getBeansOfType(HttpPutFormContentFilter.class).size(),
is(equalTo(0)));
}
@Test
public void customConfigurableWebBindingInitializer() {
load(CustomConfigurableWebBindingInitializer.class);

@ -307,6 +307,7 @@ content into your application; rather pick only the properties that you need.
spring.mvc.dispatch-trace-request=false # Dispatch TRACE requests to the FrameworkServlet doService method.
spring.mvc.dispatch-options-request=false # Dispatch OPTIONS requests to the FrameworkServlet doService method.
spring.mvc.favicon.enabled=true # Enable resolution of favicon.ico.
spring.mvc.formcontent.putfilter.enabled=true # Enable Spring's HttpPutFormContentFilter.
spring.mvc.ignore-default-model-on-redirect=true # If the content of the "default" model should be ignored during redirect scenarios.
spring.mvc.locale= # Locale to use.
spring.mvc.media-types.*= # Maps file extensions to media types for content negotiation.

Loading…
Cancel
Save