Getting a 'No thread-bound request found' error from spring in my web app

纵然是瞬间 提交于 2019-11-27 01:34:21

To use request scope without Spring MVC, you should declare RequestContextListener in web.xml (see 3.5.4.1. Initial web configuration):

<web-app>
  ...
  <listener>
    <listener-class>
        org.springframework.web.context.request.RequestContextListener
    </listener-class>
  </listener>
  ...
</web-app>

If you are configuring your app using Java instead of XML the same conf can be applied in

 public void onStartup(ServletContext servletContext) throws ServletException {
          //add listener
          servletContext.addListener(new RequestContextListener());
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!