Spring Boot @EnableScheduling conditionally
<p>Is there a way to make @EnableScheduling conditional based on an application property? also is it possible to disable controllers based on properties too?</p>

<p>What I'm trying to achieve is to have the same spring boot application used to serve web requests (but not run scheduled tasks on the same machine), and also install the same app on backend servers to run only scheduled tasks.</p>

<p>My app looks like this</p>

<pre><code>@SpringBootApplication
@EnableScheduling
@EnableTransactionManagement
public class MyApp {

   public static void main(String[] args) {
        SpringApplication.run(MyApp.class, args);
   }

}
</code></pre>

<p>And a sample scheduled job looks like this</p>

<pre><code>@Component
public class MyTask {

   @Scheduled(fixedRate = 60000)
   public void doSomeBackendJob() {
       /* job implementation here */
   }
}
</code></pre>