Refactor of Task API
This change removes the Spring Cloud Task dependency upon a CommandLineRunner from boot and moves the handling of the task lifecycle closer to the "edge" of a Spring Boot application. With this change, now a developer simply adds @EnableTask to their configuration somewhere and the task lifecycle will be recorded. Resolves spring-cloud/spring-cloud-task#39
This commit is contained in:
committed by
Glenn Renfro
parent
7be3a88826
commit
61d3cc3641
@@ -25,16 +25,15 @@ $ mvn -s settings.xml clean install
|
||||
public class MyApp {
|
||||
|
||||
@Bean
|
||||
public MyTask myTask() {
|
||||
return new MyTask();
|
||||
public MyTaskApplication myTask() {
|
||||
return new MyTaskApplication();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(MyApp.class);
|
||||
}
|
||||
|
||||
@Task("HelloWorldTask")
|
||||
public static class MyTask implements CommandLineRunner {
|
||||
public static class MyTaskApplication implements CommandLineRunner {
|
||||
|
||||
@Override
|
||||
public void run(String... strings) throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user