.....,because it is a JDK dynamic proxy that implements:

记一次注入dao层mapper导致SpringBoot启动报错的问题

在这里插入图片描述

***************************
APPLICATION FAILED TO START
***************************

Description:

The bean 'orderMapper' could not be injected as a 'org.linlinjava.litemall.db.dao.LitemallOrderMapper' because it is a JDK dynamic proxy that implements:


Action:

Consider injecting the bean as one of its interfaces or forcing the use of CGLib-based proxies by setting proxyTargetClass=true on @EnableAsync and/or @EnableCaching.

log.pattern_IS_UNDEFINED
Process finished with exit code 0

那么我这里的问题发现是我注入时用的注解是@Resource

	@Resource
    private LitemallOrderMapper orderMapper;

因为@Autowired默认按类型装配,而 @Resource优先按名称装配,如果使用@Resource时,可能有其他bean也是这个名字,所以就会出错。

那么我的解决办法是换个名字,当然也可以直接换注解为@Autowired

其他情况造成这个问题的解决办法,可以参考这篇文章
https://blog.csdn.net/w605283073/article/details/90454057

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值