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")要转换成接口,不能转换成实现类,否则会出上面的异常!
评论
发表评论

您还没有登录,请登录后发表评论

zhongzhihua
搜索本博客
最近加入圈子
存档
最新评论