【发布时间】:2020-03-30 05:30:55
【问题描述】:
我在控制器中添加了这个 url 映射
@PostMapping("/print/purchase")
public void nameOfFunction(Request Body here) {
// Some Code here
}
当我访问此网址时,我收到此错误Exception processing template "mobile/app/daily/report/print/purchase": Er
ror resolving template [mobile/app/daily/report/print/purchase], template might not exist or might not be accessible by any of the configured Template Resolvers
另一件事是我在函数内部添加了一个System.out.println("HERE!!!!!)。即使我得到那个错误。 HERE!!!! 仍然打印在控制台中。
为什么 Spring Boot 将 URL 映射视为 Thymeleaf 模板?
【问题讨论】:
-
您的问题是什么?无论如何,异常表明您在代码中的任何地方都定义了一个模板
"mobile/app/daily/report/print/purchase" -
@Patrick 我的代码只包含
System.out.println("HERE!!!!!)这一行,所以我无法定义模板。 -
@Patrick 您的第二条评论中的答案有效。谢谢!
标签: spring-boot thymeleaf