有两种解决方案:

1:在api路径中加入:.+

1 @RequestMapping("/findByIp/{ip:.+}")
2    public Object test(@PathVariable String ip) {
3        System.out.println(ip);
4        return "";
5   }

但这种方式在web服务中感觉太过于鸡肋

 

所以在springMvc.xml中配置mvc标签

2.<mvc:path-matching registered-suffixes-only="true"/>

1 <mvc:annotation-driven >
2     <mvc:path-matching registered-suffixes-only="true"/>
3 </mvc:annotation-driven>

 

 

原文链接:

https://blog.csdn.net/weixin_42599091/article/details/82666646

 

声明:此博客为个人学习之用,如与其他作品雷同,纯属巧合,转载请指明出处!

相关文章:

  • 2022-12-23
  • 2021-08-15
  • 2021-06-26
  • 2021-04-18
  • 2021-12-18
  • 2022-01-29
  • 2022-02-10
猜你喜欢
  • 2022-12-23
  • 2023-03-20
  • 2021-12-27
  • 2021-12-24
  • 2021-12-09
  • 2021-08-05
相关资源
相似解决方案