Optional int parameter 'topicId' is present but cannot be translated into a null value

项目运行成功,但是点击什么栏目或者栏目中名称带#出现500错误,后台报错代码是:
 Optional int parameter 'topicId' is present but cannot be translated into a null value due to being 
declared as a primitive type. Consider declaring it as object wrapper for the corresponding primitive 
type.

这段代码的主要意思是:
你定义的字段,我这里就是topicId这个字段定义成了int类型,但是在这个参数定义不是非必须的(也就是你的某个方法定义了这个参数,但是这个参数是非必须的,系统会自动给这个字段赋值为null值,但是int类型不能接收null值)
解决方法是:将int类型改成Integer封装类型.

猜你喜欢

转载自blog.csdn.net/limengautoman/article/details/81060750