首页 > 其他分享 >springboot项目搭建,访问controller接口失败

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

时间:2022-12-09 13:24:54浏览次数:39  
标签:springboot SpringBootApplication 接口 ComponentScan controller EnableAutoConfigura

错误表现: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的代码中也可以看出已经封装了上面的两个注解

标签:springboot,SpringBootApplication,接口,ComponentScan,controller,EnableAutoConfigura
From: https://www.cnblogs.com/rbwbear/p/16968649.html

相关文章