title: Starting Spring <tasks:scheduled-tasks>
body: <p>I am trying to use Spring Scheduling with <a href="http://static.springsource.org/spring/docs/3.0.5.RELEASE/reference/scheduling.html" rel="noreferrer">'scheduled-tasks'</a>. I can load the spring context using XmlBeanFactory, and get the scheduler bean. But I'm not sure about the next step. The docs imply that the tasks should auto start - by maybe that is only when I load the context in a container like Tomcat ?  Is it possible get the tasks to kick off when loading with <em>XmlBeanFactory</em>?</p>
  
  <p>Below is the simplified java &amp; spring config. </p>
  
  <pre><code>public class SchedulingTest {
    public static void main(String[] args) throws Exception {
  
    Resource resource = new FileSystemResource("\\my_spring_file.xml");
    BeanFactory factory = new XmlBeanFactory(resource);
  
    ThreadPoolTaskScheduler scheduler = (ThreadPoolTaskScheduler) factory.getBean("myScheduler");  
  
    // -=-=-=-=-=      
    // NOW WHAT ?
    // -=-=-=-=-=
  
    }
  }
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util"
  xmlns:task="http://www.springframework.org/schema/task"
  xsi:schemaLocation="
      http://www.springframework.org/schema/beans
      http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
      http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd
      http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd"&gt;
  
  &lt;task:scheduler id="myScheduler" pool-size="10" /&gt;
  &lt;task:scheduled-tasks scheduler="myScheduler"&gt;
      &lt;task:scheduled ref="EmailPollingTask" method="readAndProcessEmails"
          fixed-delay="30000" /&gt;
  &lt;/task:scheduled-tasks&gt;
  </code></pre>
  
  <p></p>