问题

SpringBoot启动报错

Caused by: org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named ‘batchPOMapper’ is expected to be of type ‘com.xxx.BatchMirrorRulePOMapper’ but was actually of type ‘com.sun.proxy.$Proxy129’

解决

batchPOMapper 名字改成了batchMirrorRulePOMapper

but was actually of type 'com.sun.proxy.$Proxy129' - 图1

原因是@Resource默认是按照名称来装配注入的,只有当找不到与名称匹配的bean才会按照类型来装配注入。 但是找到了名字为batchPOMapper 的bean