【发布时间】:2020-03-15 06:16:52
【问题描述】:
我无法确定 spring.io 教程中的说明是否有问题,或者 IDEA 是否有问题。一些帮助会很好。
我在 spring.io 上关注 guide 来创建一个简单的博客应用程序。我已使用 spring initializr 按指示创建应用程序(使用 Gradle、JDK 1.8、Kotlin),但我无法从 Spring Boot 运行/调试配置运行应用程序。它仅在我运行 gradle "bootRun" 任务时才有效,但通过 IntelliJ 运行会产生一个 Whitelabel 错误页面。
This application has no explicit mapping for /error, so you are seeing this as a fallback.
此外,我控制台中的 Spring Boot 输出显示 MustacheAutoConfiguration 类在我的类路径中找不到 /templates/ 文件夹。
2019-11-19 13:06:07.136 WARN 11840 --- [ restartedMain] o.s.b.a.m.MustacheAutoConfiguration : Cannot find template location: classpath:/templates/ (please add some templates, check your Mustache configuration, or set spring.mustache.check-template-location=false)
我的 BlogApplication 的 Spring Boot 运行/调试配置有“使用模块的类路径:blog.main”。
我这里还有什么遗漏的吗?
【问题讨论】:
-
您是否创建了模板文件夹?里面有你的模板吗?
-
是的。正如我所提到的,当我通过 gradle 使用它时它可以工作。所以至少所有必需的部分都在那里。