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\nbuildscript {\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}\nRun Code Online (Sandbox Code Playgroud)\n\n我的控制器:
\n\npackage 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)