attempted to return null from a method with a primitive return type (int)

報錯背景 我在使用springboot做登錄查詢的時候報錯了,我輸入的是數據庫中不存在的用戶名與密碼,返回值應該是null; 報錯信息 解決方案  把返回值類型改成Integer   我來運行看看,是否真的有效 還是報錯! 網上說把dao service返回值都改成Integer     然後再control層裏面 也是Integer接受值,這樣寫 終於不報錯了!太坎坷了!
相關文章
相關標籤/搜索