title: Spring Scheduled annotation how does it work
body: <p>I have created a function in java.That function should run on every day mid night</p>
  
  <pre><code>//My function this function is within UpdateService Class
  @Scheduled(cron = "0 0 0 * * ?")
  public static void UpdateFn() {
      try {
          System.out.println("-----------Background Task Running----------------");
          //code to update some data every day
          System.out.println("-----------Background Task Ending----------------");
      } catch (Exception e) {
          e.printStackTrace();
      }
  }
  
  //My xml configuration
   &lt;task:annotation-driven /&gt;
      &lt;bean id="UpdateTask" class="com.ss.utility.UpdateService"&gt;&lt;/bean&gt;
    &lt;/beans&gt;
  </code></pre>
  
  <p>But i not working as expected.Sometime it executed and sometime not.Any solution for this.</p>
  
  <p>Spring version is 4</p>