title: Spring request scope in HttpRequestHandlerServlet does not work
body: <p>I can't understand why the configuration does not work.</p>
  
  <p>I make spring web applcation without mvc and use HttpRequestHandlerServlet class. I need that all beans use one Connection in one request. And I set request scope in Connection bean but when I run it:</p>
  
  <pre><code>IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
  </code></pre>
  
  <p>My web.app is:</p>
  
  <pre><code>&lt;web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
  http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"&gt;
  
  &lt;listener&gt;
      &lt;listener-class&gt;
          org.springframework.web.context.ContextLoaderListener
      &lt;/listener-class&gt;
  &lt;/listener&gt;
  
  &lt;context-param&gt;
      &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
      &lt;param-value&gt;/WEB-INF/app-context.xml&lt;/param-value&gt;
  &lt;/context-param&gt;
  
  &lt;servlet&gt;
      &lt;servlet-name&gt;monitoring&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.springframework.web.context.support.HttpRequestHandlerServlet&lt;/servlet-class&gt;
  &lt;/servlet&gt;
  
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;monitoring&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/monitoring&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p></p>
  
  <p>My app-context is:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns:context="http://www.springframework.org/schema/context"
     xmlns:aop="http://www.springframework.org/schema/aop"
     xsi:schemaLocation="http://www.springframework.org/schema/beans
      http://www.springframework.org/schema/beans/spring-beans.xsd
      http://www.springframework.org/schema/context
      http://www.springframework.org/schema/context/spring-context.xsd
      http://www.springframework.org/schema/aop
       http://www.springframework.org/schema/aop/spring-aop.xsd"&gt;
  
  &lt;bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"&gt;
      &lt;property name="driverClass" value="com.mysql.jdbc.Driver" /&gt;
      &lt;property name="jdbcUrl" value="jdbc:mysql://localhost/nts" /&gt;
      &lt;property name="user" value="root" /&gt;
      &lt;property name="password" value="root" /&gt;
  
      &lt;property name="maxPoolSize" value="20" /&gt;
      &lt;property name="minPoolSize" value="5" /&gt;
      &lt;property name="maxStatements" value="100" /&gt;
      &lt;property name="testConnectionOnCheckout" value="true" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="conn" class="java.sql.Connection" factory-bean="dataSource" factory-method="getConnection" scope="request"/&gt;
  
  &lt;bean id="monitoring" class="com.sotas.terminal.server.servlet.MonitoringServlet"&gt;
      &lt;property name="monitoringService"&gt;
          &lt;bean class="com.sotas.terminal.server.service.MonitoringService"&gt;
              &lt;property name="conn" ref="conn"/&gt;
              &lt;property name="providerDAO"&gt;
                  &lt;bean class="com.sotas.terminal.server.dao.ProviderDAOImpl"&gt;
                      &lt;property name="conn" ref="conn"/&gt;
                  &lt;/bean&gt;
              &lt;/property&gt;
          &lt;/bean&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p></p>