The springboot project starts successfully but cannot execute the interface request in the controller

The springboot project started successfully but could not execute the interface request in the controller! Recently, when I was learning springboot by myself, I encountered this abnormal phenomenon. The project started normally, and the interface address was entered and requested in the front-end browser, but no data was returned. No error message was triggered either. A little confused.

Later, with the help of netizens, it was found that the cause of this situation was: in the springboot project (multi-project-master-slave project mixed mode, in the multi-project mode created by maven). The package paths and names created under the src folder must be consistent. to scan. Get the execution interface normally. Otherwise, the interface cannot be implemented.

As shown in the figure, the package path of my hnseo321-blog project (front-end project) before is com.hnseo321.controller. The package path in the public sub-project is: com.blog.*. Always failed to perform interface request.

After changing to a unified name, start the springboot project again, and the interface can execute normally and return the request data.

Share it with everyone, hoping to help friends in need. Solve such problems in a timely manner. 

Guess you like

Origin blog.csdn.net/yrldjsbk/article/details/130725132