java.lang.ClassCastException: com.sun.proxy.$Proxy30 cannot be cast to zj.style.erp.biz.impl.DepBiz

ApplicationContext ac = new ClassPathXmlApplicationContext("classpath*:applicationContext_*.xml");
DepBiz db =   (DepBiz) ac.getBean("depBiz");

在使用springAOP产生对象时, getBean产生的对象时IDepBiz的实现类DepBiz,接收的是DepBiz与之同级,不能转换

解决:

    IDepBiz db =   (IDepBiz) ac.getBean("depBiz");

猜你喜欢

转载自blog.csdn.net/zwgoldroad/article/details/80334151