Controller:

    1. package com.way.controller;
    2. import org.springframework.stereotype.Controller;
    3. import org.springframework.web.bind.annotation.RequestMapping;
    4. @Controller
    5. public class MyController {
    6. @RequestMapping(value = "/**/target")
    7. public String testAnt() {
    8. return "target";
    9. }
    10. }

    HTML:在地址中添加 /a/ab/b 多级目录。

    1. <!DOCTYPE html>
    2. <html lang="en" xmlns:th="http://www.thymeleaf.org">
    3. <head>
    4. <meta charset="UTF-8">
    5. <title>Title</title>
    6. </head>
    7. <body>
    8. <h1>首页</h1>
    9. <a th:href="@{/a/ab/b/target}">使用ant风格路径的**,访问target.html页面</a>
    10. </body>
    11. </html>

    输出结果:
    image.png