在启动类加注解@ComponentScan("com.controller")即可,括号里表示Controller所在包名。参考:https://blog.csdn.net/jialiang_chen/article/details/53871046SpringBoot Controller找不到视图路径