美文网首页
常见的错误总结

常见的错误总结

作者: 悦者生存 | 来源:发表于2017-12-04 22:14 被阅读8次

NullPointerException - 空指针引用异常

ClassCastException - 类型强制转换异常。

IllegalArgumentException - 传递非法参数异常。

ArithmeticException - 算术运算异常

ArrayStoreException - 向数组中存放与声明类型不兼容对象异常

IndexOutOfBoundsException - 下标越界异常

NegativeArraySizeException - 创建一个大小为负数的数组错误异常

NumberFormatException - 数字格式异常

SecurityException - 安全异常

UnsupportedOperationException - 不支持的操作异常

1. No setter found for the keyProperty 'id' in com.example.demo.entity.Shop.

如果出现这种错误证明你的entity里面没有定义id,比如说你数据库里面写的shop_id是主键,那么你还得定义一下id,这样insert以后返回插入的主键就不会报错了

2.如果用@RequestMapping注解的参数是int基本类型,但是required=false,这时如果不传参数值会报错,因为不传值,会赋值为null给int,这个不可以 

解决方法: 

 “Consider declaring it as object wrapper for the corresponding primitive type.”建议使用包装类型代替基本类型,如使用“Integer”代替“int”

相关文章

网友评论

      本文标题:常见的错误总结

      本文链接:https://www.haomeiwen.com/subject/icvfixtx.html