Springboot中的@Controller注解不起作用 当发现@Controller或者@RestController注解标注的类上没有Spring的标志,并且该注解也不起作用。 以上错误是因为我将controller类和xxxApplication启动类放到了同一级包下 而xxxApplication启动类必须要在其他包的最外层。 修改后就生效了。