springBoot 设置spring mvc请求地址不区分大小写
在 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);
}
}