maven做分布式的时候service测试时报错

tech2022-07-04  210

Bean named ‘userServiceImpl’ is expected to be of type ‘com.hct.service.impl.UserServiceImpl’ but was actually of type ‘com.sun.proxy.$Proxy29’

原因:service层开启事务后,会用反射去创建对象,因此测试类里面创建service的对象时,类型要用接口类型,不能用实现类的类型。

最新回复(0)