What does the following setting in application.properties in a Spring application do?
server.error.include-binding-errors=on-param
I can't find it in the documentation.
The always and never values are pretty self-explanatory, but I don't understand on-param.
                        
To begin, what I did is to do a global search on
server.error.include-binding-errorsin the library, which lead me tospring-configuration-metadata.jsonWe see the related attribute is
errorshere, and the value class isIncludeAttribute. By checking the documentation in IncludeAttribute#ON_PARAMWe know that the
errorsattribute will be added when there is a request parameter that is not "false".If you want something concrete, let's consider the following example:
Controller
DTO
Suppose we set
server.error.include-binding-errors=on-paramWhen we run with parameter errors=false
the result will not include
errorsWhen we run with parameter errors=true
the result will include
errorsasReferences:
Implementation for web reactive
DefaultErrorWebExceptionHandler#isIncludeBindingErrorsAbstractErrorWebExceptionHandler#isBindingErrorsEnabledImplementation for web servlet
BaseErrorController#isIncludeBindingErrorsAbstractErrorController#isBindingErrorsEnabled