小任班长的博客 - springBoot 设置spring mvc请求地址不区分大小写.
type: channel
link: https://cnxiaocheng.top/tag/springBoot-设置spring-mvc请求地址不区分大小写/
items: springBoot 设置spring mvc请求地址不区分大小写

springBoot 设置spring mvc请求地址不区分大小写
type: item
date: 2019-04-14T09:00:00+08:00
description: 在 spring boot项目的config目录下，创建，WebConfig类代码如下，核心属性是matcher.setCaseSensitive(false);import org.springframework.util.AntPathMatcher; import org.springframework.web.servlet.config.annotation.PathMatchConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; import org.springframework.context.annotation.Configuration; /** * springBoot 设置spring mvc请求地址不区分大小写. */ @Configuration public class WebConfig extends WebMvcConfigurationSupport { @Override public void configurePathMatch(PathMatchConfigurer configurer) { AntPathMatcher matcher = new AntPathMatcher(); matcher.setCaseSensitive(false); configurer.setPathMatcher(matcher); } }