C#项目转Java项目的时候,出现的一些问题,由于C#没有区分大小写路由,前端页面也不够规范,同一个页面,有的是大写,有的是小写,这个在java里面就必须进行javaconfig的配置处理
具体需要添加一个统一的类来路由到页面
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17package com.ly.wanle.admin.web.config; import org.springframework.util.AntPathMatcher;//需要特别注意这一行注释的问题 import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.PathMatchConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; @Configuration public class WebConfig extends WebMvcConfigurationSupport { @Override public void configurePathMatch(PathMatchConfigurer configurer) { AntPathMatcher matcher = new AntPathMatcher(); matcher.setCaseSensitive(false); configurer.setPathMatcher(matcher); } }
添加这个注释之后,就能大小写路由兼容了。
最后
以上就是清新毛衣最近收集整理的关于spring boot 关于路由大小写的问题的全部内容,更多相关spring内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复