@@ -337,29 +337,30 @@ be used.
337
337
338
338
In addition, beans may implement the `org.springframework.boot.ExitCodeGenerator`
339
339
interface if they wish to return a specific exit code when `SpringApplication.exit()`
340
- is called. This exit code can then be passed to `System.exit()` to pass it to the outside.
340
+ is called. This exit code can then be passed to `System.exit()` to return it as a status
341
+ code.
341
342
342
343
[source,java,indent=0]
343
344
----
344
345
@SpringBootApplication
345
- public class ExitCodeApplication {
346
+ public class ExitCodeApplication {
346
347
347
- public static void main(String[] args) {
348
- System.exit(SpringApplication.exit(SpringApplication.run(ExitCodeApplication.class, args)));
349
- }
348
+ public static void main(String[] args) {
349
+ System.exit(SpringApplication.exit(
350
+ SpringApplication.run(ExitCodeApplication.class, args)));
351
+ }
350
352
351
- @Bean
352
- public ExitCodeGenerator exitCodeGenerator(){
353
- return () -> 42;
354
- }
353
+ @Bean
354
+ public ExitCodeGenerator exitCodeGenerator(){
355
+ return () -> 42;
356
+ }
355
357
356
- }
358
+ }
357
359
----
358
360
359
- Also, the `ExitCodeGenerator` interface may be implemented by exceptions. When such an exception is
360
- encountered, Spring Boot will return the exit code provided by the implemented `getExitCode()` method
361
- to the outside caller.
362
-
361
+ Also, the `ExitCodeGenerator` interface may be implemented by exceptions. When such an
362
+ exception is encountered, Spring Boot will return the exit code provided by the
363
+ implemented `getExitCode()` method.
363
364
364
365
365
366
[[boot-features-application-admin]]
0 commit comments