✅ 操作成功!

Spring Boot 2.x版本出现Consider defining a bean of type 'xx' in your configuration.的错误

发布时间:2023-06-12 作者:admin 来源:文学

Spring Boot 2.x版本出现Consider defining a bean of type 'xx' in your configuration.的错误

Spring Boot 2.x版本出现Consider defining a bean of type 'xx' in your configuration.的错误

Spring Boot 2.x版本出现Consider defining a bean of type ‘xx’ in your configuration.的错误,如下图: 图片: 网上搜索到的解决方法 1:在Dao层添加@Mapper 2:启动类 xxxApplication 添加@MapperScan(“Dao层包的路径”)

然而依然不能解决该问题

至此,说明@SpringBootApplication注解肯定失效了,所以我改了启动类的注解

@ComponentScan(basePackages = "com.bankcomn.hftest.Dao") @EnableAutoConfiguration

这两个注解替换原来的注解,两种注解不能同时使用,替换后项目成功启动。

👁️ 阅读量:0