Exception in thread "main" java.lang.ClassCastExce

Exception in thread "main" java.lang.ClassCastException: $Proxy1

这是
ApplicationContext ctx = new ClassPathXmlApplicationContext("/dao-applicationContext.xml", userService.class);
// Object o=ctx.getBean("userService");
// System.out.print(o.getClass().toString());
IUserService userService2 = (IUserService) ctx.getBean("userService");


ctx.getBean("userService")要转换成接口,不能转换成实现类,否则会出上面的异常!
阅读更多

没有更多推荐了,返回首页