title: Is RequestContextHolder thread-safe?
body: <p>In my Spring JDBC project I have a class called <code>DBStuff</code> which i use to connect to DB and make simple DB operations. It's a web project and there are users, so naturally i use session mechanism. When i need to retrieve request data in <code>DBStuff</code> class, I use this line of code below:</p>
  <pre><code>HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
  </code></pre>
  <p>But, there is no explanation that if the <code>RequestContextHolder</code> is thread-safe or not. Even the spring's official <a href="https://web.archive.org/web/20170828054346/http://forum.spring.io/forum/spring-projects/web/web-flow/748410-requestcontextholder-thread-local" rel="nofollow noreferrer">forum</a> doesn't have an answer for that. Because of using servlet, I need to provide a thread-safe nature for the users.</p>
  <p>By definition <code>RequestContextHolder</code> is defined as &quot;Holder class to expose the web request in the form of a thread-bound <code>RequestAttributes</code> object.&quot; But I am not sure if &quot;thread-bound&quot; stands for thread-safe.</p>