Annotation Interface EnableTask
@Target(TYPE)
@Retention(RUNTIME)
@Documented
@Inherited
@Import(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.- Author:
- Glenn Renfro