title: Setting thread pool name for Spring tasks
body: <p>I have a fairly standard Spring 3.2 application with some tasks. In my applicationContext.xml I have</p>
  
  <pre><code>&lt;task:annotation-driven/&gt;
  </code></pre>
  
  <p>I also have some methods annotated with <code>@Scheduled</code> in the code. I'd like to give a name to the thread pools used by Spring, to simplify the log analysis. Is there any reasonably simple way to do this?
  Thanks.</p>
  
  <p><em>Update</em>: Working code:</p>
  
  <pre><code>&lt;bean id="taskExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor"&gt;
      &lt;property name="corePoolSize" value="1"/&gt;
      &lt;property name="maxPoolSize" value="5"/&gt;
      &lt;property name="queueCapacity" value="100"/&gt;
      &lt;property name="threadNamePrefix" value="executor-task-"/&gt;
      &lt;property name="threadGroupName" value="executor-tasks"/&gt;
  &lt;/bean&gt;
  &lt;bean id="taskScheduler" class="org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler"&gt;
      &lt;property name="poolSize" value="5"/&gt;
      &lt;property name="threadNamePrefix" value="scheduled-task-"/&gt;
      &lt;property name="threadGroupName" value="scheduled-tasks"/&gt;
  &lt;/bean&gt;
  &lt;task:annotation-driven executor="taskExecutor" scheduler="taskScheduler"/&gt;
  </code></pre>