报错信息Failed to convert value of type ‘java.lang.String‘ to required type ‘java.lang.Integer‘

报错信息:Failed to convert value of type ‘java.lang.String’ to required type ‘java.lang.Integer’; nested exception is java.lang.NumberFormatException: For input string: “listAllTag”

1. First report the error message on the console:

Please add a picture description

2. Analyze the cause of the error

2.1 View the interface from the front end

According to the error message, its information is probably that the front desk sent me a listAllTag of type string that cannot be converted into an Integer. After reading it for a long time, I couldn’t figure out why he would pass me a string of String because this interface is simply to get a The list collection is returned, and the front-end interface also reports 500.

Please add a picture description

2.2 View the back-end interface

Put the focus on the break point of the Controller layer and check it on the interface /tag/listAlltag, and found that it does not go through this interface at all.
Please add a picture description

#2.3 Find the reason

Please add a picture description

Since our front-end access is using the Get request, there is a /tag/{id} request in our back-end interface, and it is obtained through @PathVariable, so the back-end sends the {id} in the ListALlTag we need to request The parameter response is given to the request /tag/{id}, so we have the error message above.

3. Solution:

Change other fields such as /list/listAllTag in front of the listAllTag request to avoid the above situation.

Here I directly deleted the previous tag.

Please add a picture description

References: https://blog.csdn.net/qq_44627822/article/details/128562873?spm=1001.2101.3001.6661.1&utm_medium=distribute.pc_relevant_t0.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-1-8385 -blog-106450905.pc_relevant_recovery_v2&depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-1-128562873-blog-106450905.pc_relevant_relevant_recovery_v1&utmind

Guess you like

Origin blog.csdn.net/weixin_45572279/article/details/129467735