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

后端 未结 2 1851
温柔的废话
温柔的废话 2020-11-29 06:41

I\'m getting a \'No thread-bound request found\' error in my web app and hoping to get some help. I\'m trying to use struts2 + spring + hibernate, and use spring to manage t

相关标签:
2条回答
  • 2020-11-29 07:14

    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>
    
    0 讨论(0)
  • 2020-11-29 07:16

    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());
    
    0 讨论(0)
提交回复
热议问题