Allow ExitCodeGenerator to be used on Exceptions

Update exit code support to allow the ExitCodeGenerator interface to
be placed on an Exception. Any uncaught exception implementing the
interface and returning a non `0` status will now trigger a System.exit
with the code.

Fixes gh-4803
This commit is contained in:
Phillip Webb
2016-01-13 11:56:24 +00:00
parent d2fed8bb07
commit 7397dbaf57
10 changed files with 186 additions and 40 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2015 the original author or authors.
* Copyright 2012-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -42,6 +42,7 @@ public class SampleBatchApplication {
@Bean
protected Tasklet tasklet() {
return new Tasklet() {
@Override
public RepeatStatus execute(StepContribution contribution,
@@ -49,6 +50,7 @@ public class SampleBatchApplication {
return RepeatStatus.FINISHED;
}
};
}
@Bean