title: Execute a method after the application starts using Spring
body: <p>I have this structure in my Service component in my Spring:</p>
  
  <pre><code>@Autowired
  PointController controller;
  @Autowired
  ParametroService parametroService;
  
  Timer timer = new Timer();
  TimerTask timerTask = new TimerTask() {
      @Override
      public void run() {
          List&lt;IntRaptMec&gt; allPointments =  getNotValidated();
  
          for(IntRaptMec pointment : allPointments) {
             controller.validate(pointment.getIdTemp());
          }
      }
  };        
  
  public void doValidationsTask() {       
  
      Parametro parametroTempo = parametroService.getParametro("1", "ATRC_MEC", "TEMPO_VERIFICACAO");
      timer.scheduleAtFixedRate(
              timerTask,
              Integer.parseInt(parametroTempo.getValor()) * oneMinute,
              Integer.parseInt(parametroTempo.getValor()) * oneMinute
      );  
  
  }
  </code></pre>
  
  <p>All that I want is that after the Spring Application fully initializes it will execute the method run() inside the TimerTask. Then, after a given time in minutes that will be get from the parametroService.getParametro(), execute this task again.</p>
  
  <p>I tried to follow this link from the docs:
  <a href="https://docs.spring.io/spring/docs/current/spring-framework-reference/integration.html#scheduling-annotation-support" rel="nofollow noreferrer">https://docs.spring.io/spring/docs/current/spring-framework-reference/integration.html#scheduling-annotation-support</a></p>
  
  <p>But seems that I can't dinamically sets the Delay time that a specific task will be executed</p>