Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring@HTTP 400_Spring_Validation_Spring Validator - Fatal编程技术网

Spring@HTTP 400

Spring@HTTP 400,spring,validation,spring-validator,Spring,Validation,Spring Validator,当我将@validate注释添加到控制器中的方法签名时,我得到一个HTTP 400,其描述为“客户端发送的请求在语法上不正确()”。有人知道为什么吗 好代码 public ModelAndView startAccountSubmittal( AccountCredential accountCred, HttpServletResponse response) throws MessagingException { 错误代码 public ModelAndView s

当我将@validate注释添加到控制器中的方法签名时,我得到一个HTTP 400,其描述为“客户端发送的请求在语法上不正确()”。有人知道为什么吗

好代码

public ModelAndView startAccountSubmittal(
    AccountCredential accountCred, HttpServletResponse response) 
       throws MessagingException {
错误代码

public ModelAndView startAccountSubmittal(
    @Validated(value={AccountStates.Submitted.class}) 
        AccountCredential accountCred, 
    HttpServletResponse response, BindingResult result) 
        throws MessagingException {
提前感谢,,
Joe

我配置的未捕获异常未捕获错误。我向控制器添加了一个异常处理程序,并且能够获得详细信息。我有几个额外的字段,它正试图验证,其中包含空值,但需要值。这就是导致HTTP 400的原因。打开异常处理程序有助于获取异常和堆栈跟踪。我修改了代码并添加了额外的组,然后将这些新组添加到对象和控制器中。它按计划工作。

控制台上的日志如何。我不是专家,但这会有帮助。