欢迎访问悦橙教程(wld5.com),关注java教程。悦橙教程  java问答|  每日更新
页面导航 : > > 文章正文

SpringBoot返回结果报错org.thymeleaf.exceptions.TemplateInputException: Error resolving template "xxx/xxx", template might not exist or might not be accessible by any of the configured Template Resolvers,exceptionsto

来源: javaer 分享于  点击 23966 次 点评:99

SpringBoot返回结果报错org.thymeleaf.exceptions.TemplateInputException: Error resolving template "xxx/xxx", template might not exist or might not be accessible by any of the configured Template Resolvers,exceptionsto


原因:

在controller层请求处理完了返回时,没有使用@RestController或@ResponseBody而返回了非json格式

解决:

1,类上注解@Controller改为@RestController  注意:如果同一个controller中有其他方法需要返回html页面路径,这个时候需要换成方法2,否则返回的是页面地址,而不是页面
2,在报错的方法上添加@ResponseBody注解

相关文章

    暂无相关文章
相关栏目:

用户点评