@ConditionalOnProperty(prefix = “spring.mvc.hiddenmethod.filter”, name = “enabled”, matchIfMissing = false)
public OrderedHiddenHttpMethodFilter hiddenHttpMethodFilter() {
return new OrderedHiddenHttpMethodFilter();
}
从源码看出容器中有@ConditionalOnMissingBean(WebMvcConfigurationSupport.class)这个注解。
当容器中没有这个组件的时候,这个自动配置类才生效
因此当选择继承 WebMvcConfigurationSupport 以后还需要 重写它里面的方法。
然而问题又出来了,这样的继承会导致静态资源失效。
如何解决这个问题?
/**
-
An implementation of {@link WebMvcConfigurer} with empty methods allowing
-
subclasses to override only the methods they’re interested in.
-
@author Rossen Stoyanchev
-
@since 3.1
-
@deprecated as of 5.0 {@link WebMvcConfigurer} has default methods (made
-
possible by a Java 8 baseline) and can be implemented directly wi