springmvc,有的controller映射的到,有的映射不到(断点没进去)。No mapping found for……

控制台报错:
警告: No mapping found for HTTP request with URI [/holy-spring/user/userInfo] in DispatcherServlet with name 'dispatcher'

clipboard.png
clipboard.png

clipboard.png

UserController映射不到,断点都没进去,JsonParserController可以正常打开。
很奇怪,对比了是一样的啊?

clipboard.png

难道是 * 号配置路径的问题? 可是我还是不懂为什么有的可以访问有的不行。
烦请过路大神帮忙答疑解惑,多谢!

阅读 4.1k
3 个回答

我特么,原来是包名写错了。
吃了文化的亏啊。。

配置是没有问题的。

还有就是记得修改mybatis里mapper.xml文件里的路径。

=================================================================
最开始只报了一个
警告: No mapping found for HTTP request with URI [/holy-spring/user/userInfo] in DispatcherServlet with name 'dispatcher'
我也找不到是哪里的问题,后来试着把controller换到可以映射到的controller的同一目录下,报了另一个出错
严重: Context initialization failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userController': Unsatisfied dependency expressed through field 'userService': No qualifying bean of type [line.moduls.user.service.UserService] found for dependency [line.moduls.user.service.UserService]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)};

才发现是包名拼错了。

新手上路,请多包涵

凡是觉得的不科学的错误,99%是自己的粗心造成的,所以写代码的时候要细心,谨慎copy

想起了当年~~~加油哈

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题