Junit 启动报错是动态代理的原因吗?

错误提示:

Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'customerController': Unsatisfied dependency expressed through field 'customerApiToSF'; nested exception is org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'customerApiToSF' is expected to be of type 'com.business.basedata.cust.web.CustomerApiToSF' but was actually of type 'com.sun.proxy.$Proxy105'
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:586)
    at
描述;使用junit单元测试报错

代码:单元测试代码image.png
报错类的代码:image.png
依赖注入代码:image.png
请大佬们看看是什么原因导致的错误!!感谢大佬们伸出援手,有知道的大佬吗?

阅读 1.9k
1 个回答

好像是CustomerApiToSF这个类被代理了,是不是有aop相关配置

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题