新的商城模板调试接口,一个商品列表的接口调用,返回报错

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的更多相关文章

  1. 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", ...

  2. 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 ...

  3. template might not exist or might not be accessible by any of the configured Template Resolvers

    距离上一篇文章已经很长时间了,最近太忙碌了,今天发布spring boot遇到一个问题,找了好久才找到解决办法,今天贴出来和大家一起分享下,首先看错误信息 HTTP Status 500 - Requ ...

  4. 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 ...

  5. 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 ...

  6. 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 ...

  7. 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 ...

  8. 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 ...

  9. 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 ...

  10. 【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 ...

随机推荐

  1. 【调制解调】VSB 残留边带调幅

    说明 学习数字信号处理算法时整理的学习笔记.同系列文章目录可见 <DSP 学习之路>目录,代码已上传到 Github - ModulationAndDemodulation.本篇介绍 VS ...

  2. 用googletest写cpp单测

    框架概述 Google Test(也称为 googletest)是由 Google 开发的 C++ 单元测试框架.它的首个版本是在2004年发布的,作为 Google 内部的测试框架使用.随后,Goo ...

  3. Composer 镜像原理 (1) —— 初识 Composer

    相关文章 Composer 镜像原理 (1) -- 初识 Composer Composer 镜像原理 (2) -- composer.json Composer 镜像原理 (3) -- 完结篇 何为 ...

  4. [爬虫]2.3.1 使用Python操作文件系统

    Python提供了许多内置库来处理文件系统,如os.shutil和pathlib等,这些库可以帮助你创建.删除.读取.写入文件和目录. 读取文件 在Python中,你可以使用内置的open函数来打开一 ...

  5. 使用Docker安装Apollo并使用SpringBoot连接配置中心

    上篇文章我们学习了Apollo的本地安装,如果还不会本地安装的朋友可以查看之前的文章进行了解和学习链接地址(https://www.cnblogs.com/eternality/p/17583023. ...

  6. C#/.net/DotNet/Emgu.CV裁剪照片头像

    头像裁剪有利于人脸识别批量照片预处理,安防领域可以快速通过视频定位人脸,进行抓拍,做人脸识别相关功能的可能会应用到人脸裁剪,以下是我在实践中应用的代码,如有需要复制粘贴即可使用. using Emgu ...

  7. redis 中的 字符串

    String是redis 中的最基本的类型, 为二进制安全  ,意味着String可以表示各种类型  一个字符串value 最大为 521M set k1 v100 set k2 v200 get 命 ...

  8. [django]路由变量与正则表达式

    示例: urlpatterns = [ path('detail.<int:id>.html', detailView, name='detail'), ] 路由变量的类型 示例路由配置了 ...

  9. 带你读论文丨S&P21 Survivalism: Living-Off-The-Land 经典离地攻击

    本文分享自华为云社区<[论文阅读] (21)S&P21 Survivalism: Living-Off-The-Land经典离地攻击>,作者: eastmount . 摘要 随着恶 ...

  10. 【路由器】Breed 介绍、刷入和使用

    目录 介绍 文件说明 刷入 Breed 通过 Breed 刷机 其他功能 参考资料 介绍 Breed 是国内个人 hackpascal 开发的闭源 Bootloader,也被称为"不死鸟&q ...