title: dynamic loading of cron time for a spring batch job
body: <p>Requirement is :a spring batch job to be run on a particular time for different countries.</p>
  
  <p>currently,"cron" time is loaded from a property file.can i dynamically change the cron time for a particular country from sql database.</p>
  
  <p>conclusion: cron time needs to be loaded based on country.</p>
  
  <p>current configuration: </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;bean id="taskscheduler" class="main.java.com.asbatch.newsfeed.BatchTaskScheduler"/&gt; 
  
  
   &lt;task:scheduled-tasks&gt;
   &lt;task:scheduled ref="taskscheduler" method="run" cron="${newsfeed_time}"/&gt;
    &lt;/task:scheduled-tasks&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>BatchTaskScheduler class</p>
  
  <pre><code>public class BatchTaskScheduler
  </code></pre>
  
  <p>{</p>
  
  <pre><code>@Autowired
  private JobLauncher launcher;
  
  @Autowired
  private Job job;
  
  private static final Logger LOGGER = Logger.getLogger(BatchTaskScheduler.class);
  
  public void run()
  {
  
      try
      {
         launcher.run(job, new JobParameters());
  
      }
      catch (JobExecutionAlreadyRunningException e)
      {
          LOGGER.info("JobExecutionAlreadyRunningException: " + e);
  
      }
      catch (JobRestartException e)
      {
  
         LOGGER.info("JobRestartException: " + e);
  
      }
      catch (JobInstanceAlreadyCompleteException e)
      {
  
          LOGGER.info("JobInstanceAlreadyCompleteException: " + e);
  
      }
      catch (JobParametersInvalidException e)
      {
  
          LOGGER.info("JobParametersInvalidException: " + e);
  
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>can any body please help me on this ?</p>