Define CommandExceptionResolver bean order

- CommandParserExceptionResolver uses default bean
  order -100.
- Backport #634
- Fixes #635
This commit is contained in:
Janne Valkealahti
2023-01-25 17:57:13 +00:00
parent d7f0459874
commit 32fc72329b
3 changed files with 22 additions and 3 deletions

View File

@@ -45,3 +45,11 @@ you want to define exit code there.
include::{snippets}/ErrorHandlingSnippets.java[tag=my-exception-class]
----
====
Some build in `CommandExceptionResolver` beans are registered to handle common
exceptions thrown from command parsing. These are registered with _order_
presedence defined in `CommandExceptionResolver.DEFAULT_PRECEDENCE`.
As these beans are used in a given order, `@Order` annotation or `Ordered`
interface from can be used just like in any other spring app. This
is generally useful if you need to control your own beans to get used
either before or after a defaults.