SpringBoot Circular view path错误
在运行SpringBoot时报了这样一个错误
百度翻译是视图循环
搜索一下 原来是类上restcontroller写成了controller
对比一下两者
@Controller和@RestController的区别?
官方文档:
@RestController is a stereotype annotation that combines @ResponseBody and @Controller.
意思是:
@RestController注解相当于@ResponseBody + @Controller合在一起的作用。
1)如果只是使用@RestController注解Controller,则Controller中的方法无法返回jsp页面,配置的视图解析器InternalResourceViewResolver不起作用,返回的内容就是Return 里的内容。
例如:本来应该到success.jsp页面的,则其显示success.
2)如果需要返回到指定页面,则需要用 @Controller配合视图解析器InternalResourceViewResolver才行。
3)如果需要返回JSON,XML或自定义mediaType内容到页面,则需要在对应的方法上加上@ResponseBody注解。
然后把controller 修改成restcontroller 后成功返回页面
SpringBoot Circular view path错误的更多相关文章
- SpringBoot 报错: Circular view path [readingList] 解决办法
spring boot报错: Circular view path [readingList]: would dispatch back to the current handler URL [/re ...
- 如何在Spring MVC Test中避免”Circular view path” 异常
1. 问题的现象 比如在webConfig中定义了一个viewResolver public class WebConfig extends WebMvcConfigurerAdapter { //配 ...
- Circular view path [home]: would dispatch back to the current handler URL [/home] again. Check your ViewResolver setup!
Circular view path [home]: would dispatch back to the current handler URL [/home] again. Check your ...
- 如何在Spring MVC Test中避免”Circular view path” 异常(转)
文章转自http://www.cnblogs.com/chry/p/6240965.html 1. 问题的现象 比如在webConfig中定义了一个viewResolver public class ...
- Circular view path [mydemo]: would dispatch back to the current handler URL [/mydemo] again. Check your ViewResolver setup!
简单创建一个springboot工程 pom.xml <?xml version="1.0" encoding="UTF-8"?><proje ...
- Circular view path xxx would dispatch back to the current handler URL,Check your ViewResolver setup
Circular view path xxx would dispatch back to the current handler URL 通过原因分析,造成问题有两个因素:1). 缺省转发, 2). ...
- Spring Boot项目Circular view path问题解决
使用Spring Boot创建Spring MVC项目,访问url请求出现问题:Circular view path 1.问题描述 控制台打印: javax.servlet.ServletExcept ...
- javax.servlet.ServletException: Circular view path [index]: would dispatch back to the current handler URL [/pay/index] again. Check your ViewResolver setup!
2019-08-08 17:12:03.544 ERROR 13748 --- [nio-8080-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Se ...
- web项目——javax.servlet.ServletException: Circular view path [registerForm]
报错: 控制台输出: 三月 21, 2019 10:12:32 上午 org.springframework.web.servlet.PageNotFound noHandlerFound 警告: N ...
- mock测试出现Circular view path [trade_records]: would dispatch back to the current handler URL
这是因为你的Controller中返回的视图名称与你当前的requestMapping名称一样,这并没有很好的解决方案,除非你改掉其中一个名字. 因为springframework test时你并没有 ...
随机推荐
- 用if语句替换三元运算符-标准的switch语句
用if语句替换三元运算符 在某些简单的应用中,if语句是可以和三元运算符互换使用的. public static void main(String[] args) { int a = 10; int ...
- Unity_UIWidgets新手入门
Unity_UIWidgets新手入门 Hello Everyone!好久没见了,有没有有些想念小黑呢?什么?这么想?哈哈哈哈哈哈,不过我也知道你是想了解新的知识了,才不是想我嘞. 好了,好歹也半年没 ...
- vue3 | slots
一.什么是插槽 插槽就是子组件中的提供给父组件使用的一个占位符,用<slot></slot> 表示,父组件可以在这个占位符中填充任何模板代码,如 HTML.组件等,填充的内容 ...
- 笔记: C#RabbitMQ初步使用记录
Rabbitmq 的使用场景有哪些? ①. 跨系统的异步通信,所有需要异步交互的地方都可以使用消息队列.就像我们除了打电话(同步)以外,还需要发短信,发电子邮件(异步)的通讯方式. ②. 多个应用之间 ...
- java helloworld demo
大二的时候写过 web 仅限于 idea 配合 springboot, 学习的时候需要写个 java demo 或者算法, 居然不知道怎么写了 首先创建一个文件夹, 写上你的代码, 因为是demo, ...
- Cheat Engine 中文设置汉化教程
下载地址:https://www.cheatengine.org/downloads.php 下载windows 安装版本以及中文翻译包: 1.安装程序:一路NEXT即可 2.打开程序安装位置在在文件 ...
- IoT 边缘集群基于 Kubernetes Events 的告警通知实现(二):进一步配置
上一篇文章 IoT 边缘集群基于 Kubernetes Events 的告警通知实现 目标 告警恢复通知 - 经过评估无法实现 原因: 告警和恢复是单独完全不相关的事件, 告警是 Warning 级别 ...
- 读写wav格式文件
读写wav格式文件 本文所有相关代码(包括未来的)均可在该代码库找到 https://gitcode.net/PeaZomboss/learnaudios 本文代码在MinGW-w64 gcc/g++ ...
- 学习Java Day21
今天学习了静态导入,可以导入静态方法和静态字段
- JZOJ 3167.查税
\(\text{Solution}\) 记 \(k\) 这个办公室相关属性有 \(t,z,s\) 对于以后的某一天 \(T\),其账户余额为 \((T-t)z+s\) 要最大化这东西,不妨另 \(b= ...