java.lang.ClassCastException: com.service.impl.OrderPlanServiceImpl cannot be cast to com.provider.service.IUserInfoService
at com.easylabplus.provider.test.UserInfoTest.testUserInfoService(UserInfoTest.java:17)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

问题提示没有在第二个类当中找到你注册的Service名字

原因是我的测试类中没有写好Service对应的映射名字

 @Test
public void testUserInfoService() throws Exception {
ClassPathXmlApplicationContext aContext = new ClassPathXmlApplicationContext(
"applicationContext.xml");
//问题就是下边这个userInfoService的名字写错了
IUserInfoService userInfoService = (IUserInfoService) aContext
.getBean("userInfoService");
List<UserInfo> list = userInfoService.queryAll();
Gson g = new Gson();
System.out.println(g.toJson(list)); }

最新文章

  1. mysql-批量修改表字段中的某一部分内容
  2. 【CentOS】ifconfig命令 :command not found &amp; yum命令 :cannot find a valid baserl for repo: base/7/x86_64
  3. C#中常用的转义字符及@符号的一些作用
  4. HttpRequest重写,解决资源战胜/链接超时/分块下载事件通知 问题。
  5. App开发
  6. Hive分布式的数据仓库
  7. linux编辑器 vi的使用
  8. ssh无密登录
  9. keepalive的 nopreempt 非抢占
  10. js 实现div模块的截图并下载功能(可制作长图)
  11. 单点登录实现机制:桌面sso
  12. Python 3 利用 Dlib 19.7 实现摄像头人脸识别
  13. java 23种设计模式教程
  14. 解决linux root 认证失败的问题
  15. java集合框架(1) hashMap 简单使用以及深度分析(转)
  16. chrome 插件 导出与导入,以apizza SQ为例
  17. glide 解决 golang.org/x/net 等依赖包无法获取
  18. Git_创建版本库
  19. poj3107 Godfather 求树的重心
  20. excel宏调用webservice使用存储过程同步excel数据的方法

热门文章

  1. Phonegap 开发环境搭建
  2. java Long
  3. 转转转---ROWNUMBER() OVER( PARTITION BY COL1 ORDER BY COL2)用法
  4. charles手机抓包配置-2
  5. Train-Alypay-Cloud:mPaaS 移动开发平台培训(第一次)
  6. [saiku] 简介、下载、安装和教程
  7. Creating an Android Project(创建一个android项目)
  8. SpringBoot入门(2)
  9. django-csrf_exempt
  10. django-中间件,流量统计实例