admin 管理员组文章数量: 1086019
今天学习尚硅谷的SpringCloud时,发现支付模块无法启动,控制台输出下面的错误:
看起来可能是dao层没有被注入。
然后根据我已有的知识,我检查了注解@Mapper
@Mapper
public interface PaymentDao {
public int create(Payment payment);
public Payment getPaymentById(@Param("id") long id);
}
pom也添加了starter-web依赖:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
然后不知道原因了,于是凭借死马当活马医的理念,试着在启动类添加了注解@ComponentScan,结果启动成功
@SpringBootApplication
@ComponentScan(basePackages = {"com.atguigu.springcloud.dao"})
public class PaymentMain8001 {
public static void main(String[] args){
SpringApplication.run(PaymentMain8001.class, args);
}
}
我是跟着视频,一行代码,一行代码的照着敲的。视频里是没有写@ComponentScan的,但是视频里却能成功启动。难道我看的视频不完整?还是什么其他原因?哎,搞不懂。。。
本文标签: Bean defining Type Configuration xxxx
版权声明:本文标题:Consider defining a bean of type ‘XXXX‘ in your configuration. 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://roclinux.cn/b/1738332820a1965289.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论