title: Ways to get to thread created in SimpleAsyncTaskExecutor.createThread(Runnable runnable)
body: <p>In my application using Spring Batch 3.0.1 I need to get access to the thread created by <em>SimpleAsyncTaskExecutor.createThread(Runnable runnable)</em> before it is started in <em>doExecute</em>.</p>
  
  <p>This needs to be done to attach security context stuff to the newly created thread.</p>
  
  <p>Of course I could extend SimpleAsyncTaskExecutor and use this class, but that seems a crude solution.
  I tried using Spring AOP and interceptors, but cannot intercept the right method.</p>
  
  <p>Any ideas?</p>
  
  <p>Edit:  </p>
  
  <pre><code>protected void doExecute(Runnable task) {
      Thread thread = (this.threadFactory != null ? this.threadFactory.newThread(task) : createThread(task));
      thread.start();
  }
  </code></pre>