SpringBoot+Thyemleaf报错Template might not exist or might not be accessible

第一次搭建SpringBoot+Thyemleaf项目,就遇见这个错误,所以记录一下

出现这个错误大致从以下几个方面排除

1、application.yml的配置问题

2、pom.xml导入,需导入以下依赖

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
    <groupId>org.thymeleaf</groupId>
    <artifactId>thymeleaf-spring5</artifactId>
    <version>3.0.9.RELEASE</version>
</dependency>
<dependency>
    <groupId>net.sourceforge.nekohtml</groupId>
    <artifactId>nekohtml</artifactId>
    <version>1.9.22</version>
</dependency>

3、上述配置之后,执行maven clean -------maven install。

原文地址:https://www.cnblogs.com/ma-zhuo/p/11751802.html

时间: 2024-11-09 02:14:46

SpringBoot+Thyemleaf报错Template might not exist or might not be accessible的相关文章

SpringBoot+Thyemleaf开发环境正常,打包jar发到服务器就报错Template might not exist or might not be accessible

网上查看了各种解决的思路,总结如下: 1. 在controller层请求处理完了返回时,没有使用@RestController或@ResponseBody而返回了非json格式 这种情况下返回的数据thymeleaf模板无法解析,直接报错,本人正式因为这个原因才报错. 解决方案:可以将@Controller换成@RestController,不过需要注意有没有其他的方法返回了html页面,会导致返回的不是页面而是字符串:最好的方法就是在你所请求的方法上面加一个@ResponseBody即可. 2

springboot启动报错退出,To display the conditions report re-run your application with &#39;debug&#39; enabled.

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.2019-01-19 12:01:39.870 ERROR 8324 --- [  restartedMain] o.s.b.d.LoggingFailureAnalysisReporter   : ***************************APPLICATIO

springboot启动报错start bean &#39;eurekaAutoServiceRegistration&#39; NullPointerException

解决方案参考:https://blog.csdn.net/hhj13978064496/article/details/82825365 我将eureka的依赖包放到了依赖包的最下面,启动报错, 如下: <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId&

springboot启动报错:&quot;Error starting ApplicationContext. To display the conditions report re-run your application with &#39;debug&#39; enabled.&quot;

报错内容 java.lang.Object.wait(Native Method)java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143)com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:41)2019-02-14 14:58:00.326 INFO 17688 --- [ main] Condition

运行springboot项目报错:Field userMapper in XX required a bean of type &#39;xx&#39; that could not be found.

运行springboot项目报错: *************************** APPLICATION FAILED TO START *************************** Description: Field userMapper in com.whohim.springboot.service.impl.UserServiceImpl required a bean of type 'com.whohim.springboot.dao.UserMapper' t

异常:Error resolving template &quot;xxx&quot;, template might not exist or might not be accessible...解决办法

简单表述:控制台出现了这个异常:Error resolving template "xxx", template might not exist or might not be accessible by any of the configured Template Resolvers 解决办法:在报出这个异常的方法上添加注解@ResponseBody 讲一下个人理解:这个注解就是用来区别 方法的返回值字符串 和 视图解析器解析的页面名字字符串 的冲突的,举个例子:方法A返回的字符串s

Spring Boot使用thymeleaf模板时报异常:template might not exist or might not be accessible by any of the configured Template Resolvers

错误如下: template might not exist or might not be accessible by any of the configured Template Resolvers 解决方法: 1.确定模板是否在默认templates文件夹里面,并且路径要和返回的View名字一致. 2.new ModelAndView("/log/loglist");这样写是不对的,应该把开头的斜杠去掉,改成:new ModelAndView("log/loglist&

template might not exist or might not be accessible by any of the configured Template Resolvers 完美解决

初学者在maven spring boot web项目中使用thymeleaf 模板,经常会遇到  “template might not exist or might not be accessible by any of the configured Template Resolvers”这个问题,让人很头疼.其实这个错误的描述很清楚: 第一.模板不存在 ,第二.模板无法被解析器解析 带着这两个问题来找答案: 首先确定在Maven的资源管理文件中  pom.xml确保引入 spring-bo

springboot连接数据库报错testWhileIdle is true, validationQuery not set

问题描述: 使用springboot连接数据库,启动的时候报错:testWhileIdle is true, validationQuery not set.但是不影响系统使用,数据库等一切访问正常. application.properties数据源配置如下: spring.datasource.username=root spring.datasource.password= spring.datasource.driver-class-name=org.mariadb.jdbc.Drive