springboot项目搭建,访问controller接口失败

错误表现:This application has no explicit mapping for /error, so you are seeing this as a fallback.
image

在启动类上的注解:@EnableAutoConfiguration

解决:

  1. 使用这个注解@SpringBootApplication
  2. 或添加这个注解@ComponentScan(basePackages="com.ruyuan.springBoot")

注:

  1. @EnableAutoConfiguration + @ComponentScan = @SpringBootApplication
  2. 在@SpringBootApplication的代码中也可以看出已经封装了上面的两个注解
posted @ 2022-12-09 13:05  lq-12040  阅读(278)  评论(0)    收藏  举报