title: How to schedule task in java code
body: <p>I know how to schedule task in spring context:</p>
  
  <pre><code>  &lt;task:scheduler id="taskScheduler" pool-size="1" /&gt;
    &lt;task:scheduled-tasks scheduler="taskScheduler"&gt;
      &lt;task:scheduled ref="jobWatcher" method="run" cron="*/10 * * * * ?" /&gt;
    &lt;/task:scheduled-tasks&gt;
  </code></pre>
  
  <p>But cron of my task can by configured during runtime so I need to create task in java code. In spring docs: <a href="http://docs.spring.io/spring/docs/3.0.x/reference/scheduling.html" rel="noreferrer">http://docs.spring.io/spring/docs/3.0.x/reference/scheduling.html</a> is something like this:</p>
  
  <pre><code>scheduler.schedule(task, new CronTrigger("* 15 9-17 * * MON-FRI"));
  </code></pre>
  
  <p>which is what I want but I have no idea how their create  scheduler in this example and what is his class. Please help</p>