小编Noo*_*oob的帖子

百里香叶;“模板解析期间发生错误”

I\xc2\xb4m 当前在使用 springboot 时遇到问题,并且出现错误“模板解析期间发生错误(模板:“类路径资源 [templates/mainpage.html])”。

\n\n

我\xc2\xb4ve尝试重新安装不同版本的lombok,因为我认为这可能是问题所在,但到目前为止似乎没有任何效果。我\xc2\xb4m 使用 gradle 和 Eclipse 作为 IDE。\n感谢任何帮助,由于不同的 springBootVersions,发现了一些具有相同问题的线程,但尝试了旧的和新的,它也没有\xc2\xb4t 为我修复它。

\n\n

我的build.gradle看起来像这样:

\n\n
buildscript {\next {\n    springBootVersion = \'2.0.3.RELEASE\'\n}\nrepositories {\n    mavenCentral()\n}\ndependencies {\n    classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")\n}\n}\n\napply plugin: \'java\'\napply plugin: \'eclipse\'\napply plugin: \'org.springframework.boot\'\napply plugin: \'io.spring.dependency-management\'\n\ngroup = \'test\'\nversion = \'0.0.1-SNAPSHOT\'\nsourceCompatibility = 1.8\n\nrepositories {\n mavenCentral()\n}\n\ndependencies {\n  compile(\'org.springframework.boot:spring-boot-starter-thymeleaf\')\n  compile(\'org.springframework.boot:spring-boot-starter-web\')\n  runtime(\'org.springframework.boot:spring-boot-devtools\')\n  testCompile(\'org.springframework.boot:spring-boot-starter-test\')\n  compileOnly \'org.projectlombok:lombok:1.18.2\'\n}\n
Run Code Online (Sandbox Code Playgroud)\n\n

我的控制器

\n\n
package test;\n\nimport org.springframework.stereotype.Controller;\nimport org.springframework.ui.Model;\nimport org.springframework.web.bind.annotation.GetMapping;\nimport org.springframework.web.bind.annotation.PostMapping;\n\n@Controller\npublic class ExampleController {\n\n    @GetMapping(path = "/")\n    public String mainpage(Model model) {\n        return "mainpage";\n    }\n\n    @PostMapping(path = …
Run Code Online (Sandbox Code Playgroud)

thymeleaf spring-boot

5
推荐指数
1
解决办法
4万
查看次数

标签 统计

spring-boot ×1

thymeleaf ×1