Postman test interface appears 404

Postman test interface appears 404

1. In the process of debugging the interface with postman, a 404 situation occurs, but the interface has obviously been transferred, and the data has been stored in the database, which makes me feel very confused. I checked my path by looking at the solution on the Internet, the submission method, parameter type, etc. are all correct, but 404 is reported.
2. After checking the controller, I found the problem. You need to replace the @Controller annotation with @RestController, or add @ResponseBody to the method.

insert image description here

Summary: 404 resource not found, nothing more than the interface path, there are problems with the submission method, parameter type, and return result type.
And I'm having a problem with the return type. The interface is written as @Controller, and the @ResponseBody annotation is not added to the method, which will jump to the page corresponding to the returned result name (that is, the result of return). No such page is found, so it is 404. And our interface returns data in json format, so add @ResponseBody.

Guess you like

Origin blog.csdn.net/weixin_48616345/article/details/131685629