这是我的一次 很2的bug 自己犯错的~~
刚开始为了快,写个注解事务的测试代码用的是:
SprHiberServiceImpl sh = (SprHiberServiceImpl)ctx.getBean("sprHiber");
然后就一直报错 $Proxy5 cannot be cast to hiber.SprHiberServiceImpl
然后百度来google去,发现改成:
SprHiberService sh = (SprHiberService)ctx.getBean("sprHiber");
就可以运行了。
原因: 注解事务是AOP实现的,AOP是需要接口的
转载请注明原文地址: https://ju.6miu.com/read-964517.html