title: Static variable value in Spring request scoped bean survives session
body: <p>Below you can see <code>Something</code> class which is a <code>request</code> scoped bean I've been facing one issue with.
  Once I set the <code>static boolVariable</code> field its value survives along sessions.</p>
  
  <p><strong>Scenario</strong>:
  User in the application does something that sets variable to true, then it logs out, clears every data (cookie, cache...). When it logs again into application, <code>boolVariable</code> is still <code>true</code> (he did not set his value again), while I expect it to be false.</p>
  
  <p>Quote from <a href="http://www.concretepage.com/spring/spring-bean-scope-example-using-scope-annotation-and-xml-for-singleton-prototype-request-session-global-session-and-application-scope-with-scoped-proxy#request" rel="nofollow noreferrer">concretepage</a>:</p>
  
  <blockquote>
    <p>Within HTTP request, the changes done in request scoped bean does not
    affect the other HTTP request. Once HTTP request is completed, the
    instance of request scoped bean is also destroyed.</p>
  </blockquote>
  
  <p>Here is the <code>Something</code> class:</p>
  
  <pre><code>@Service(value = "Something")
  @Scope(value = "request")
  public class Something {
  
      private static boolean boolVariable = false;
  
      public Something() {
      }
  
      public static void setBoolVariable(boolean toBeSaved) {
          boolVariable = toBeSaved;
      }
  
      private boolean isBoolVariable() {
          return boolVariable;
      }
  
  }
  </code></pre>
  
  <p>Could you please explain why behaviour described above happens?
  <em>(When I restart the server, <code>boolVariable</code> value is restored back to <code>false</code>)</em></p>