springmvc支持ant风格的路径
![](https://img2023.cnblogs.com/blog/2111933/202303/2111933-20230308210449143-1559057880.png)
controller
@RequestMapping("/test?Hello/demo") public String test1(){ return "success"; } @RequestMapping("/test*/demo") public String test2(){ return "success"; } @RequestMapping("/**/demo") public String test3(){ return "success"; }
页码访问
<!DOCTYPE html> <html lang="en" xmlns:th="http://www.thymeleaf.org"> <head> <meta charset="UTF-8"> <title>首页</title> </head> <body> <h1>index的内容222</h1> <a th:href="@{/hello}">测试springmvc</a><br> <a th:href="@{/test5Hello/demo}">测试?匹配单个字符</a><br> <a th:href="@{/test12345/demo}">测试*匹配单个字符</a><br> <a th:href="@{/asdasdg/demo}">测试**匹配单个字符</a><br> </body> </html>