Error resolving template [sys/prod/prod/list], template might not exist or might not be accessible by any of the configured Template Resolvers
新的商城模板调试接口,一个商品列表的接口调用,返回报错
org.thymeleaf.exceptions.TemplateInputException: Error resolving template [sys/prod/prod/list], template might not exist or might not be accessible by any of the configured Template Resolvers
at org.thymeleaf.engine.TemplateManager.resolveTemplate(TemplateManager.java:869)
at org.thymeleaf.engine.TemplateManager.parseAndProcess(TemplateManager.java:607)
at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1098)
at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1072)
at org.thymeleaf.spring5.view.ThymeleafView.renderFragment(ThymeleafView.java:362)
at org.thymeleaf.spring5.view.ThymeleafView.render(ThymeleafView.java:189)
问题原因:

在controller上加注解@Controller 和@RestController都可以在前端调通接口,但是二者的区别在于,当用前者的时候在方法上必须添加注解@ResponseBody,
如果不添加@ResponseBody,就会报上面错误,因为当使用@Controller 注解时,spring默认方法返回的是view对象(页面)。
而加上@ResponseBody,则方法返回的就是具体对象了。
@RestController的作用就相当于@Controller+@ResponseBody的结合体
修改为@RestController 后正常
Error resolving template [sys/prod/prod/list], template might not exist or might not be accessible by any of the configured Template Resolvers的更多相关文章
- org.thymeleaf.exceptions.TemplateInputException: Error resolving template "/home/index2", template might not exist or might not be accessible by any of the configured Template Resolvers
org.thymeleaf.exceptions.TemplateInputException: Error resolving template "/home/index2", ...
- Error resolving template,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 at o ...
- template might not exist or might not be accessible by any of the configured Template Resolvers
距离上一篇文章已经很长时间了,最近太忙碌了,今天发布spring boot遇到一个问题,找了好久才找到解决办法,今天贴出来和大家一起分享下,首先看错误信息 HTTP Status 500 - Requ ...
- template might not exist or might not be accessible by any of the configured Template Resolvers at org.thymeleaf.engine.TemplateManager.resolveTemplate(TemplateManager.java:869)
org.thymeleaf.exceptions.TemplateInputException: Error resolving template [code/leading], template m ...
- 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 Resolver ...
- 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 accessib ...
- SpringBoot使用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 ...
- Error resolving template “pages”, template might not exist or might not be accessible by any of the configured Template Resolver 或者 springboot使用thymeleaf时报html没有结束标签
application.properties配置文件 spring.thymeleaf.prefix=classpath:/templates/ spring.thymeleaf.suffix=.ht ...
- org.thymeleaf.exceptions.TemplateInputException: Error resolving template "/ template might not exist or might not be accessible by any of the configured
异常现象:在本地打包部署完全没有问题,资源文件也都可以映射上,但是打包成jar包部署到服务器上时,就一直报异常,异常信息如下: 严重: Servlet.service() for servlet [d ...
- 【SpringBoot+Mybatis+thymeleaf报错】Error resolving template "XXX", template might not exist or might not be accessible by any of the configured
解决方法一: 原因:在使用springboot的过程中,如果使用thymeleaf作为模板文件,则要求HTML格式必须为严格的html5格式,必须有结束标签,否则会报错. 在application.y ...
随机推荐
- 我开源了团队内部基于SpringBoot Web快速开发的API脚手架stater
我们现在使用SpringBoot 做Web 开发已经比之前SprngMvc 那一套强大很多了. 但是 用SpringBoot Web 做API 开发还是不够简洁有一些. 每次Web API常用功能都需 ...
- Seeion相关
存储会话数据有两种方式: Cookie 1) 存储在浏览器端,通过服务器发送cookie数据 2) 使用cookie存储会话数据,相对不安全(可以cookie查到一些用户安全) 3) 从存储数据类型来 ...
- Centos7下创建Oracle用户
Centos7下创建Oracle用户 Oracle中,一个用户其实就类似于一个数据库,本次就来创建一个新用户 登录 将系统用户切换到oracle用户下 su - oracle -- 启动sqlplus ...
- golang channel 未关闭导致的内存泄漏
现象 某一个周末我们的服务 oom了,一个比较重要的job 没有跑完,需要重跑,以为是偶然,重跑成功,因为是周末没有去定位原因 又一个工作日,它又oom了,重跑成功,持续观察,job 在oom之前竟然 ...
- 2022-1-11 面板控件学习1 Canvas、WrapPanel、StackPanel、DockPanel、Grid
Canvas WrapPanel 让控件横向排列 StackPanel 控件竖向排列 DockPanel 自由布局,LastChildFill防止最后一个控件自动填充满 Grid 使用*和2*可以分配 ...
- RedHat8静默安装was
前言 was(websphere application server),类似weblogic.tomcat,由IBM开发的一种企业级Java容器. 系统版本:redhat 8.2 was版本:was ...
- Windows安装hexo并配置nginx
前言 Hexo是一款基于NodeJS的静态博客框架,依赖少且易于安装使用,可以方便地生成静态网页. 本文记录Windows安装hexo,配置第三方主题Fluid,并配置nginx的全过程. nodej ...
- MyBatis-Plus批量插入方法saveBatch
1. saveBatch能否提高插入的效率? 先说结论,saveBatch()方法也是一条一条的插入,也就是说它会产生多条insert语句,而不是一条insert语句,所以它不是真正的批量插入,更不能 ...
- (数据科学学习手札154)geopandas 0.14版本新特性一览
本文示例代码已上传至我的Github仓库https://github.com/CNFeffery/DataScienceStudyNotes 1 简介 大家好我是费老师,就在前两天,Python生态中 ...
- MinIO分布式部署
目录 先决条件 网络和防火墙 网络 防火墙 负载均衡 顺序的主机名 驱动器要求 XFS格式性能最优 最小IO 顺序的驱动器名 任意迁移 时间同步 考虑 相同的硬软件环境 存储容量规划 推荐的操作系统 ...