1. 程式人生 > >Optional int parameter 'category_id' is present but cannot

Optional int parameter 'category_id' is present but cannot

Optional int parameter 'category_id' 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.

在這裡插入圖片描述
1.將Controller層category_id型別改為Integer;
2.如果出現如下情況:

Request processing failed; nested exception is java.lang.NullPointerException

必須判斷category_id是否為空.