@Target(value=TYPE) @Retention(value=RUNTIME) @Documented @Inherited @Import(value=SimpleTaskConfiguration.class) public @interface EnableTask
Enable Spring Task features.
@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
you will have an instance of TaskConfigurer
. If one is not specified then the
DefaultTaskConfigurer
will be used.
You will also be able to @Autowired
some useful stuff into your context:
TaskRepository
(bean name "taskRepository").
Copyright © 2017 Pivotal Software, Inc.. All rights reserved.