我已经通过我的 spring mvc Web 应用程序很好地注释了映射,但是它们区分大小写。我找不到一种方法使它们不区分大小写。 (我很乐意在 Spring MVC 中实现这一点,而不是以某种方式重定向流量)
Spring 4.2将支持不区分大小写的路径匹配。 https://jira.spring.io/browse/SPR-13286您可以按如下方式配置:
@Configuration
public class WebConfig extends WebMvcConfigurerAdapter {
@Override
public void configurePathMatch(PathMatchConfigurer configurer) {
AntPathMatcher matcher = new AntPathMatcher();
matcher.setCaseSensitive(false);
configurer.setPathMatcher(matcher);
}
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)