当前使用版本(必填,否则不予处理)
3.5.3,jdk11,springboot 2.6.1
该问题是如何引起的?(确定最新版也有问题再提!!!)
在Service中通过@Resource注入,启动时会出现如下的报错信息,通过@Autowired则没问题
重现步骤(如果有就写完整)
报错信息
Description:
The bean 'bankMapper' could not be injected because it is a JDK dynamic proxy
The bean is of type 'com.sun.proxy.$Proxy111' and implements: com.xxx.xxx.project.bank.mapper.BankMapper
Expected a bean of type 'com.xxx.xxx.project.user.mapper.UserBankMapper' which implements: com.baomidou.mybatisplus.core.mapper.BaseMapper
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.
Comment From: helloAping
使用BaseService自带的baseMapper即可