Updated the order in which the TaskLifecycleListener is configured
resolves #605
This commit is contained in:
committed by
Michael Minella
parent
af078ec763
commit
e60c29d41d
@@ -45,7 +45,7 @@ import org.springframework.context.ApplicationEvent;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.SmartLifecycle;
|
||||
import org.springframework.context.event.ContextRefreshedEvent;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@@ -70,7 +70,8 @@ import org.springframework.util.StringUtils;
|
||||
* @author Michael Minella
|
||||
* @author Glenn Renfro
|
||||
*/
|
||||
public class TaskLifecycleListener implements ApplicationListener<ApplicationEvent>, SmartLifecycle, DisposableBean {
|
||||
public class TaskLifecycleListener implements ApplicationListener<ApplicationEvent>,
|
||||
SmartLifecycle, DisposableBean, Ordered {
|
||||
|
||||
@Autowired
|
||||
private ConfigurableApplicationContext context;
|
||||
@@ -394,4 +395,9 @@ public class TaskLifecycleListener implements ApplicationListener<ApplicationEve
|
||||
}
|
||||
this.taskExecutionListeners.add(this.taskListenerExecutorObjectProvider.getObject());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return HIGHEST_PRECEDENCE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -294,6 +294,7 @@ The following example shows the three annotations in use:
|
||||
}
|
||||
----
|
||||
|
||||
NOTE: If you using a `ApplicationListener` early in Spring's Lifecycle this could impact TaskLifecycleListener's functionality.
|
||||
|
||||
[[features-task-execution-listener-Exceptions]]
|
||||
==== Exceptions Thrown by Task Execution Listener
|
||||
|
||||
Reference in New Issue
Block a user