Resolved [org.springframework.web.method.annotation.ModelAttributeMethodProcessor$1: org.springframework.validation.BeanPropertyBindingResult: 4 errors<EOL>Field error in object 'order' on field 'order_id': rejected value [null]; codes [typeMismatch.order.order_id,typeMismatch.order_id,typeMismatch.int,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [order.order_id,order_id]; arguments []; default message [order_id]]; default message [Failed to convert value of type 'null' to required type 'int'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type [null] to type [int] for value [null]; nested exception is java.lang.IllegalArgumentException: A null value cannot be assigned to a primitive type]<EOL>Field error in object 'order' on field 'phone': rejected value [null]; codes [typeMismatch.order.phone,typeMismatch.phone,typeMismatch.int,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [order.phone,phone]; arguments []; default message [phone]]; default message [Failed to convert value of type 'null' to required type 'int'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type [null] to type [int] for value [null]; nested exception is java.lang.IllegalArgumentException: A null value cannot be assigned to a primitive type]<EOL>Field error in object 'order' on field 'buy': rejected value [null]; codes [typeMismatch.order.buy,typeMismatch.buy,typeMismatch.int,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [order.buy,buy]; arguments []; default message [buy]]; default message [Failed to convert value of type 'null' to required type 'int'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type [null] to type [int] for value [null]; nested exception is java.lang.IllegalArgumentException: A null value cannot be assigned to a primitive type]<EOL>Field error in object 'order' on field 'total': rejected value [null]; codes [typeMismatch.order.total,typeMismatch.total,typeMismatch.int,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [order.total,total]; arguments []; default message [total]]; default message [Failed to convert value of type 'null' to required type 'int'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type [null] to type [int] for value [null]; nested excep
时间: 2024-04-27 13:23:21 浏览: 12
这段错误信息表明在订单管理系统中,有一个名为order的对象中的四个字段(order_id, phone, buy, total)未能成功转换为int类型,因为它们的值为null,而null值无法赋给原始类型(int)。因此,在处理这些字段之前,需要先确保它们都赋有适当的值。您可以通过在代码中添加一些空值检查或默认值来解决这个问题。另外,您还可以考虑使用Java类中的包装类型(Integer)来代替原始类型(int),因为它们可以接受null值并且在使用时会更加灵活。
相关问题
Resolved [org.springframework.web.method.annotation.MethodArgumentTypeMismatchException
Resolved [org.springframework.web.method.annotation.MethodArgumentTypeMismatchException: Failed to convert value of type 'java.lang.String' to required type 'int'; nested exception is java.lang.NumberFormatException: For input string: "errorView"] 是一个解决方法参数类型不匹配的异常,它表示在进行方法调用的时候,传入的参数类型无法正确转换为方法所要求的类型。具体来说,这个异常表示一个字符串无法转换为整数类型,而且字符串的内容是"errorView"。这个异常通常发生在使用Spring框架进行Web开发的过程中,当请求参数的类型与方法定义的参数类型不匹配时会抛出该异常。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [Resolved [org.springframework.web.method.annotation.MethodArgumentTypeMismatchException](https://blog.csdn.net/qq_63943929/article/details/130085851)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* [SpringMVC自定义日期转换器不起作用,报400错误,Failed to convert value of type xxx to required type ...](https://blog.csdn.net/qq_40542534/article/details/109249187)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
Resolved [org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'DELETE' not supported]
Resolved [org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'DELETE' not supported]表示请求方法不支持删除操作。根据引用中的代码示例,可以看出在该代码中只有一个RequestMapping注解,且该注解指定了"GET"方法。因此,对于其他方法(例如DELETE),该方法是不支持的。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [报错:Resolved [org.springframework.web.HttpRequestMethodNotSupportedException: Request method ...](https://blog.csdn.net/m0_52861000/article/details/130489613)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [Resolved [org.springframework.web.HttpRequestMethodNotSupportedException: Request method ‘GET‘ not...](https://blog.csdn.net/qq_44347175/article/details/125697957)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [org.springframework.web.servlet-3.1.0.RELEASE](https://download.csdn.net/download/hankcyh/8361943)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]