报错内容如下

Optional int parameter 'id' is present but cannot be translated into a null value due to being declared as a primitive type.

解决办法

将 int 改成 Integer。

Integer 是基本数据类型 int 的包装类。int 的初值为 0,Ingeter 的初值为 null。

一般情况下,尽量使用 Integer ,而不是 int。

相关文章: