title: Spring ThreadPoolTaskScheduler vs ThreadPoolTaskExecutor
body: <p>It is mentioned in the <a href="http://docs.spring.io/spring/docs/current/spring-framework-reference/html/scheduling.html" rel="noreferrer">Spring documentation</a> that:</p>
  
  <blockquote>
    <p><code>ThreadPoolTaskScheduler</code> actually implements Spring's <code>TaskExecutor</code> interface as well, so that a single instance can be used for asynchronous execution as soon as possible as well as scheduled, and potentially recurring, executions. </p>
  </blockquote>
  
  <p>So which are the scenarios where we would want to use <code>ThreadPoolTaskExecutor</code> instance over <code>ThreadPoolTaskScheduler</code> instance?</p>
  
  <p>I am using currently using Spring XML. I am creating bean of <code>ThreadPoolTaskScheduler</code> as follows:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;task:scheduler id="myScheduler" pool-size="1"/&gt;
  </code></pre>
  
  <p>while bean of <code>ThreadPoolTaskExecutor</code> instance can be created as </p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;task:executor id="executor" pool-size="10"/&gt;
  </code></pre>