本站资源收集于互联网,不提供软件存储服务,每天免费更新优质的软件以及学习资源!

SpringBoot小demo中出现“Errorresolvingtemplate”错误:如何解决Thymeleaf模板引擎无法找到或访问模板?

网络教程 app 1℃

SpringBoot小demo中出现“Errorresolvingtemplate”错误如何解决Thymeleaf模板引擎无法找到或访问模板

spring boot 小 demo 出现 error resolving template 错误

问题描述

作者在构建 spring boot 小 demo 时遇到错误 error resolving template [], template might not exist or might not be accessible by any of the configured template resolvers。

问题分析

该错误表明 thymeleaf 模板引擎无法找到或访问指定模板。

解决方案

要解决此问题,需要确认以下几点:

    pom 文件中已引入 spring boot 的 thymeleaf 起始器:

<dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-thymeleaf</artifactid></dependency>

    application.properties 文件中已配置 thymeleaf 视图解析器:

spring.thymeleaf.mode=HTML5spring.thymeleaf.cache=false

    确保 jsp 文件或其他模板文件存在于正确的位置,并在 templates 目录下。

代码修正

作者没有提供完整的代码,因此无法提供具体建议。但是,可以根据上述检查点,检查自己的代码并进行必要的更改。

以上就是Spring Boot 小 demo 中出现 “Error resolving template” 错误:如何解决 Thymeleaf 模板引擎无法找到或访问模板?的详细内容,更多请关注范的资源库其它相关文章!

转载请注明:范的资源库 » SpringBoot小demo中出现“Errorresolvingtemplate”错误:如何解决Thymeleaf模板引擎无法找到或访问模板?

喜欢 (0)