用spring对struts2的Action加AOP时应该把接口注入而不是实现类,否则会出[$Proxy6]异常

用spring对struts2的Action加AOP时应该把接口注入而不是实现类,否则会出[$Proxy6]错误
我靠~费了2天时间解决这个烂问题,没想到这么简单,以下转载。
Bean named 'studentsDao' must be of type [com.firstssh.dao.StudentsDao], but was actually of type [$Proxy6]

出现这种情况的原因是因为你在action中注入时应该把接口注入而不是实现类,既@Resource private StudentsDao studentsDao 这样spring注入的是一个代理类[$Proxy6],得改为@Resource private DaoInterface daoInterface;