Spring boot 添加到模型后,Thymeleaf页面上的字符串为空

Spring boot 添加到模型后,Thymeleaf页面上的字符串为空,spring-boot,thymeleaf,Spring Boot,Thymeleaf,我的控制器: @Controller public class IndexController { @RequestMapping(value = "/index") public String index(Model model) { model.addAttribute("message", "Hello World!"); return "index"; } } 我的页面: <!DOCTYPE html> <ht

我的控制器:

@Controller
public class IndexController {

    @RequestMapping(value = "/index")
    public String index(Model model) {
        model.addAttribute("message", "Hello World!");
        return "index";
    }
}
我的页面:

<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
   <head>
      <meta charset = "ISO-8859-1" />
      <link href = "css/styles.css" rel = "stylesheet"/>
      <title>Spring Boot Application</title>
   </head>
   <body>
      <h4>Spring boot.</h4>
      <p th:utext="${message}"></p>
   </body>
</html>
加载和呈现时,将显示此HTML;如何让消息显示

<!DOCTYPE html>
<html>
   <head>
      <meta charset = "ISO-8859-1" />
      <link href = "css/styles.css" rel = "stylesheet"/>
      <title>Spring Boot Application</title>
   </head>
   <body>
      <h4>Spring boot.</h4>
      <p></p>
   </body>
</html>

确保已将thymeleaf依赖项导入到项目中。
永远不会调用IndexController中的Use-th:text=${message}

方法,因为:

@RequestMapping(value = "/index")
应该是这样的:

@RequestMapping(value = "/")

我看不出问题的原因。maven或gradle文件中列出了对thymeleaf的依赖关系?