SpringBoot注解不起作用

Springboot中的@Controller注解不起作用

当发现@Controller或者@RestController注解标注的类上没有Spring的标志,并且该注解也不起作用。
SpringBoot注解不起作用_第1张图片

以上错误是因为我将controller类和xxxApplication启动类放到了同一级包下

SpringBoot注解不起作用_第2张图片

而xxxApplication启动类必须要在其他包的最外层。

SpringBoot注解不起作用_第3张图片

修改后就生效了。

你可能感兴趣的:(spring,java,spring,boot)