UserServiceImpl service = ontext.getBean(
"userServiceImpl", UserServiceImpl.class);
org.springframework.beans.factory.
BeanNotOfRequiredTypeException
:Bean named 'userServiceImpl' is expected to
be of type 'com.mvc.service.Impl.UserServiceImpl'
but was actually of type 'com.sun.proxy.$Proxy21'
UserServiceImpl service = (UserServiceImpl)
context.getBean("userServiceImpl");
java.lang.ClassCastException: com.sun
.proxy.$Proxy21 cannot be cast to com.mvc.service.
Impl.UserServiceImpl
只有使用接口才不会错
UserService service = context.getBean
("userServiceImpl", UserService.class);
UserService service = (UserService)
context.getBean("userServiceImpl");
new CPX 使用错误
最新推荐文章于 2022-07-25 10:57:05 发布