title: How to start scheduled jobs dynamically with Spring (and Quartz)?
body: <p>I'm following <a href="http://websystique.com/spring/spring-4-quartz-scheduler-integration-example/" rel="nofollow">this</a> tutorial to schedule jobs with Spring.</p>
  
  <p>In the tutorial scheduling is started by the following code:</p>
  
  <pre><code>public static void main(String args[]){
      AbstractApplicationContext context = new ClassPathXmlApplicationContext("app-config.xml");
  }
  </code></pre>
  
  <p>Instead of using main, i'd like to start jobs with a method that can be called from anywhere in my application, for example:</p>
  
  <pre><code>public void startJobs() {
      // what should this method do to start the jobs?
  }
  </code></pre>
  
  <p>Can the following work?</p>
  
  <pre><code>public void startJobs() {
      AbstractApplicationContext context = new ClassPathXmlApplicationContext("app-config.xml");
  }
  </code></pre>
  
  <p>Is this considered good practice?</p>
  
  <p>Basically what i want to achieve is to be able to start the jobs whenever i want (whenever i call the <code>startJobs()</code> method), not on startup in the main method.</p>
  
  <p>How can i do this? </p>