今天遇到一个问题,

The DispatcherServlet configuration needs to include a HandlerAdapter that supports this handler


原因是@Controller注释未生效,需在xml添加<mvc:annotation-driven />

<mvc:annotation-driven/>相当于注册了DefaultAnnotationHandlerMapping和AnnotationMethodHandlerAdapter

这两个bean,配置一些messageconverter。

所以当我们需要controller返回一个map的json对象时,一定要设定<mvc:annotation-driven />

相关文章:

  • 2022-12-23
  • 2021-07-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-09
猜你喜欢
  • 2022-12-23
  • 2021-11-18
  • 2021-10-01
  • 2021-04-22
  • 2021-08-09
  • 2021-07-11
  • 2021-12-23
相关资源
相似解决方案