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。

猜你喜欢

转载自www.cnblogs.com/youcoding/p/13201384.html