Failed to convert property value of type java.lang.String to required type java.lang.Integer for property mobile; nested exception is java.lang.NumberFormatException: For input string: "13333332233"

前一阵捣鼓一个开源项目发现这个问题是前台传值时,后台是下图这样:

public AjaxJson create(@Valid @ModelAttribute("data") User user, BindingResult result,HttpServletRequest request, HttpServletResponse response) {return doSave(user, request, response, result);}

这里的user中有个手机号DTO为Integer类型,前台转换mobile只要超过10个字符就会报上面的异常。

这个问题根本原因还是设计问题,Integer最大值为2147483647,spring遇到前端这样的超大范围会默认转成String类型,所以会报这个异常。

建议手机号这种号码类还是用字符串这种类型设计为好。

Failed to convert property value of type java.lang.String to required type java.lang.Integer for pro相关推荐

  1. spring:Failed to convert property value of type ‘java.lang.String‘ to required type ‘java.util.Date‘

    前言 springboot有接口日期转换的经典问题,给Entity加@JsonFormat解决了输出json日期格式的输入输出问题,但是解决不了非@RequestBody/也就是普通表单提交的日期格式 ...

  2. Failed to convert value of type 'java.lang.String' to required type 'java.util.Date

    异常原因:Controller层获取JSP页面请求参数是String类型,而在Controller层接收时使用Date类型,属于方法参数类型不匹配异常 警告: Failed to bind reque ...

  3. Cannot convert value of type ‘java.lang.String‘ to required type ‘java.util.Map‘ for property ‘param

    问题描述 若依中使用feign进行远程调用,在get请求中使用@SpringQueryMap映射对象时,映射对象的父类中带有Map<String, Object>类型的params属性时, ...

  4. Failed to convert value of type ‘java.lang.String‘ to required type ‘java.util.Date‘;

    在Java的controller中添加一个方法即可解决 /*** 解决:Failed to convert value of type 'java.lang.String' to required t ...

  5. 报错: Cannot convert value of type ‘java.lang.String‘ to required type

    报错: Cannot convert value of type 'java.lang.String' to required type Caused by: java.lang.IllegalSta ...

  6. Filed to convert property value of type ‘java.lang.String‘ to required type ‘java.util.Date‘ for XX

    添加注解: @DateTimeFormat:前端传值到后台接收准确的Date类属性 @JsonFormat:数据库到实体类的Date类型转换 @JsonFormat(pattern = "y ...

  7. 配置文件报错 Cannot convert value of type ‘java.lang.String‘ to required type ‘javax.sql.DataSource‘ for p

    问题 <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean&qu ...

  8. Spring Boot 集成Kafka java.lang.String is in module java.base of loader ‘bootstrap‘;

    异常信息:java.lang.String is in module java.base of loader 'bootstrap'; com.htcyaifline.common.kafka.dom ...

  9. Unable to make field private final byte[] java.lang.String.value accessible: module java.base does n

    问题: Unable to make field private final java.lang.String java.io.File.path accessible: module java.ba ...

最新文章

  1. Nodejs中搭建一个静态Web服务器,通过读取文件获取响应类型
  2. Django - 网页加载报错:A server error occurred. Please contact the administrator(亲测)
  3. Atitit.多媒体区----web视频格式的选择总结
  4. spectral安装
  5. fastdfs java token_fastdfs 开启 token 防盗链
  6. Android开发笔记(六十八)工程库打包
  7. 数据分析没价值?——深思对业务的洞察有多少?
  8. 信号与系统实验一 信号在MATLAB中的表示
  9. 使用QT+webassembly构建在线报表设计器
  10. TCP/IP协议是什么计算机网络基础理论
  11. JavaScript实现京东首页轮播图
  12. office2016、visio2016和project2016安装指针
  13. Internal error: : 8 [#1] PREEMPT SMP ARM,vmlinux反汇编命令调试查找错误的步骤
  14. 斯考特·杨(Scott Young)快速学习方法
  15. 遇到问题---maven---启动项目出现出现 java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoa
  16. 用Python做了鉴黄模型,内含多20万张“不可描述”图片
  17. 嵌入式开发笔记——CPLD与MCU模拟SPI通信
  18. 在unity中读取并可视化dicom图像(fo-dicom / C# / unity)
  19. docker webdav_跨主机容器共享数据卷(webdav 双向同步)
  20. QNAP文件传输服务器,如何通过 DLNA/UPnP 欣赏存储在 QNAP NAS 上的多媒体内容?

热门文章

  1. Intel Realsense D435 当usb显示为2.x时,是否能正常运行? 2.1 3.2
  2. python opencv 如何给图片添加文字?cv2.putText() PIL
  3. pytorch 常用的 loss function
  4. 天梯赛 L1-039 古风排版 (20 分)
  5. Spring Boot文档地址
  6. sentry 命令_sentry(二)集成sourcemap
  7. @order注解_Spring Boot+OAuth2,一个注解搞定单点登录!
  8. select下拉框赋值和取值
  9. activemq启动wrapper stopped
  10. springboot七牛云---报{“error“:“download token auth failed“}错误