我是靠谱客的博主 甜甜大侠,这篇文章主要介绍SpringBoot @RequestMapping地址不区分大小写一、创建配置文件WebConfig二、编写测试接口三、结果,现在分享给大家,希望可以做个参考。

SpringBoot @RequestMapping地址不区分大小写

  • 一、创建配置文件WebConfig
  • 二、编写测试接口
  • 三、结果

一、创建配置文件WebConfig

示例:pandas 是基于NumPy 的一种工具,该工具是为了解决数据分析任务而创建的。

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package com.au.sss.config; import org.springframework.context.annotation.Configuration; import org.springframework.util.AntPathMatcher; import org.springframework.web.servlet.config.annotation.PathMatchConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; @Configuration class WebConfig implements WebMvcConfigurer { @Override public void configurePathMatch(PathMatchConfigurer configurer) { AntPathMatcher matcher = new AntPathMatcher(); matcher.setCaseSensitive(false); configurer.setPathMatcher(matcher); } }

二、编写测试接口

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
package com.au.sss.controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController public class TestController { @RequestMapping("/test") public String test(){ return "test"; } }

三、结果

请添加图片描述

最后

以上就是甜甜大侠最近收集整理的关于SpringBoot @RequestMapping地址不区分大小写一、创建配置文件WebConfig二、编写测试接口三、结果的全部内容,更多相关SpringBoot内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(54)

评论列表共有 0 条评论

立即
投稿
返回
顶部