title: Methods with @Scheduled annotation not working in Spring Boot app
body: <p><strong>tl;dr: Can you think of any case I could look for where <code>@Scheduled</code> tasks are not executed in a Spring Boot app?</strong></p>
  
  <p>I implemented the <a href="https://spring.io/guides/gs/scheduling-tasks/" rel="nofollow noreferrer">example</a> and it worked just fine, however, in a more complex Spring Boot app I am working on I can't get the <code>@Scheduled</code> methods to run.</p>
  
  <p>My main class looks like this:</p>
  
  <pre><code>package com.mypackage.myapp;
  
  import org.springframework.boot.SpringApplication;
  import org.springframework.boot.autoconfigure.SpringBootApplication;
  import org.springframework.scheduling.annotation.EnableScheduling;
  import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
  
  @SpringBootApplication
  @EnableWebSecurity
  @EnableScheduling
  public class MyApp {
      public static void main(String[] args) {
          SpringApplication.run(MyApp.class);
      }
  }
  </code></pre>
  
  <p>and the component in which the scheduled app lives looks like this:</p>
  
  <pre><code>(...)
  
  @Component
  public class MyComponent {
      private static final Logger logger = LoggerFactory.getLogger(MyComponent.class);
  
      (...)
  
      @Scheduled(fixedRate = 5000)
      public void myScheduledTask() {
          logger.info("Executing scheduled task");
  
      (...)  
      }
  }
  </code></pre>
  
  <p>The whole application is obviously more complex, but this is essentially it. Unfortunately, <code>"Executing scheduled task"</code> appears no where in the logs, also if I debug the breakpoint is never reached.</p>
  
  <p>As I said, the minimal example works for me, however in my app it isn't. Can you think of any case I could check for where <code>@Scheduled</code> tasks are not executed? For example, can the configuration be overruled by anything? Can anything interfere?</p>
  
  <p>I am using version <code>1.5.1.RELEASE</code>.</p>