@Target(value=TYPE) @Retention(value=RUNTIME) @Documented @Inherited @Import(value=TaskLifecycleConfiguration.class) public @interface EnableTask
Enables the TaskLifecycleListener so
that the features of Spring Cloud Task will be applied.
@Configuration
@EnableTask
public class AppConfig {
@Bean
public MyCommandLineRunner myCommandLineRunner() {
return new MyCommandLineRunner()
}
}
Note that only one of your configuration classes needs to have the
@EnableTask annotation. Once you have an
@EnableTask class in your configuration the task will have the Spring
Cloud Task features available.Copyright © 2019 Pivotal Software, Inc.. All rights reserved.