but was actually of type 'com.sun.proxy.$Proxy19'
在做Spring Aop 注解类型的时候报的错误。
解决完包的问题后报:
Exception in thread "main" org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'customerService' is expected to be of type 'com.itheima.service.impl.CustomerServiceImpl' but was actually of type 'com.sun.proxy.$Proxy19'
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:392)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:204)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1089)
at com.itheima.ui.Client.main(Client.java:11)
解决方法 从网上找到了方法:把下面的注解加上就好了,需要proxyTargetClass = true; 才可以
@EnableAspectJAutoProxy(proxyTargetClass = true)
jar包版本