title: Spring and scheduled/repeated task
body: <p>I'm using Spring and have created a web application. In my web app I've a rest service. I have one rest method called process which takes in a user's details (from an angular ui) and saves the users details to a database (SQLite)</p>
  
  <p>Basically what I want to do is that when a user initiates a rest call. I want to start a separate thread (of only which one will exist).  This thread will poll a database for certain values and emails an administrator if certain values are found. I need the class to be thread safe. See the below. Am I correct in using something like this ?. Do I need an @Async annotation ? Or should i use a TimerTask instead ?</p>
  
  <pre><code>@EnableScheduling
  public class DBPoller {
  
      @Scheduled(fixedRate = 5000)
      public void checkDatabase() {
          //checks the db for certain values
      }
  }
  </code></pre>