还是先看下面一段话:
Spring MVC has a strategy for generating error codes for rendering error messages from binding errors: MessageCodesResolver. If you set thespring.mvc.message-codes-resolver.format property PREFIX_ERROR_CODE or POSTFIX_ERROR_CODE, Spring Boot creates one for you (see the enumeration inDefaultMessageCodesResolver.Format).
上面说的是,springmvc提供了一种渲染错误代码的策略。ps:一般用于binging error
我个人认为springmvc之所以提供这个接口,主要是因为很多时候绑定错误没办法准确定位,比如下面:
下面是两个例子