org.springframework.web.servlet.NoHandlerFoundException: No handler found for GET

Hello, I’m Chenxi. Recently, I have come to sort out my own bugs, share and gain new knowledge, and make progress together.

Recently the project startup server reported this exception

org.springframework.web.servlet.NoHandlerFoundException: No handler found for GET

In addition to "404" means that the page you want to browse is lost, do you know how it happened?

Insert picture description here

Why is the page you want to visit lost? Why can the console catch the exception?

The situation I encountered is that the console can output this exception at this time, and the front end reports an error 404

org.springframework.web.servlet.NoHandlerFoundException: No handler found for GET

Now you can see the error of Java's background explosion-in fact, it means that the front end sent a request and accessed this server.

Insert picture description here

Backend server path

http://localhost:8080

For example, what you want to access is the following interface (real path in the background)

The correct interface: http://localhost:8080/test/listGoods

But now you accidentally typed the wrong path on the front end and does not match the background

Error interface: http://localhost:8080/test/listGood

At this time, it is equivalent to that the service will enter the controller layer but the following exception will be exploded if the path under the controller is not found

@RequestMapping("/test")
public class TestsController {

The above is exactly the reason for this exception, so the console will print out the exception description


Solution: Check the front-end path and modify it correctly.


The best investment is to invest in yourself.

Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_45393094/article/details/108401010