springboot controller visit 404

Two solutions:
1. Because of the SpringBoot project startup class, it will only scan the files under the package or change the files in all sub-packages under the package, as long as you move the file to the same directory of the startup class and report it.


2. Add the annotation
@ComponentScan(basePackages= {"com.bootapplication.Beans","com.bootapplication.controller","com.bootapplication.service","com.zbootapplicationz. mapper"}) All the involved classpaths are added. Note that different packages are separated by commas.

 

Simple, rude and effective method:

Put the startup class in the root directory of the package so that all sub-packages and classes will be scanned

 

 

 

Guess you like

Origin blog.csdn.net/zengmingen/article/details/106412395