Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Circular view path [login]: would dispatch back to the current handler URL [/login] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)] with root cause
javax.servlet.ServletException: Circular view path [login]: would dispatch back to the current handler URL [/login] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)
如上是报错信息,当你的访问路径和返回路径相同时它会报500,错误是视图路径循环
但是当你的路径设置不一样的时候报404错误,原因基本上就是 thymeleaf 这个依赖没有导入
我也是被这个问题折磨过无数遍,明明加了这个依赖,他就是一直有这个错误,怎么弄都不行,有时候新建一个项目又可以了,但是不行的时候你就一点办法没有,直到今天对比了两个项目才发现原因
原因是你添加了这个依赖但是包没有导入到你的项目中去,
左边是我的xml文件 右边是我的包路径,依赖有了,就是没有包,这bug是真的离谱,重启项目更新maven包更新项目包任你怎么弄它里面就是不会有这个包,而且项目一开始是导入进去的,后面我改依赖删了之后再导就导不进去了,有的情况是第一次导也进不去,真是神奇的bug
经过一天时间的发现,把 springboot这个包导入的话就可以把thymeleaf包导入
但是导入的包依旧报错,原因是导入的包不完整,然后就是不断的降低 thymeleaf 版本找到一个低版本的可以用了之后把springboot包注释了也不会报错,就tm离谱