亚洲好骚综合-亚洲黄色录像-亚洲黄色网址-亚洲黄色网址大全-99久久99久久-99久久99久久精品国产

您的位置:軟件測試 > 開源軟件測試 > 開源單元測試工具 > junit
Spring Junit讀取配置文件
作者:怪盜-基德 發(fā)布時間:[ 2017/3/17 14:10:12 ] 推薦標(biāo)簽:Junit 單元測試

  配置文件放在class目錄下:
  ApplicationContext applicationContext = new ClassPathXmlApplicationContext("spring.xml");
  WEB-INF下:
  ApplicationContext applicationContext = new FileSystemXmlApplicationContext("WebRoot/WEB-INF/spring.xml");
  多個文件可用*表示
  ApplicationContext applicationContext = new FileSystemXmlApplicationContext("WebRoot/WEB-INF/spring.xml");
  注解方式:
  class:
  @ContextConfiguration(locations={"classpath:spring.xml"})
  WEB-INF:
  @ContextConfiguration(locations={"file:WebRoot/WEB-INF/spring.xml"})
  使用注解時,Junit報錯:
java.lang.NoSuchFieldError: NULL
at org.junit.runners.ParentRunner.<init>(ParentRunner.java:48)
at org.junit.runners.BlockJUnit4ClassRunner.<init>(BlockJUnit4ClassRunner.java:59)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.<init>(SpringJUnit4ClassRunner.java:104)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.junit.internal.requests.ClassRequest.buildRunner(ClassRequest.java:33)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:28)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:28)
  經(jīng)檢查是jar包沖突,我在建項目的時候,myeclipse有自動加入junit4,而后面我又自己加入Junit4.8.1。
  如果報以下錯誤,則是junit包版本太低,需要4.5或以上的版本
Caused by: java.lang.ClassNotFoundException: org.junit.runners.BlockJUnit4ClassRunner
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)

軟件測試工具 | 聯(lián)系我們 | 投訴建議 | 誠聘英才 | 申請使用列表 | 網(wǎng)站地圖
滬ICP備07036474 2003-2017 版權(quán)所有 上海澤眾軟件科技有限公司 Shanghai ZeZhong Software Co.,Ltd
主站蜘蛛池模板: 91短视频在线观看免费 | 免费一级欧美片在线观免看 | 国产视频二区在线观看 | 天天白天天谢天天啦 | 成人毛片免费网站 | 国产一级高清视频在线 | 日本一区二区免费在线观看 | 国产精品91视频 | 涩涩逼| 91精品国产亚一区二区三区 | 综合激情网五月 | 国产黄色小视频在线观看 | 亚洲激情在线 | 久久精品视频日本 | 欧美精品亚洲精品日韩 | 77788色淫网站免费视频 | 最近最新中文字幕免费高清1 | 欧美人与动人物a级网站 | 亚洲国产成a人v在线观看 | 亚洲国产观看 | 伊人久久亚洲综合天堂 | 欧美日韩一区二区中文字幕视频 | 亚洲一区不卡 | 高清无遮挡在线观看 | 欧美日韩一区二区三 | 国产香蕉免费精品视频 | 夜夜摸夜夜操 | 伊人日日夜夜 | 成人欧美一区二区三区视频 | 一个人的视频日本免费 | 日日射射| 亚洲欧美成人网 | 中文字幕在线观看一区二区 | 欧美日韩a | 欧美zozozo人禽交免费大片 | 国产又黄又免费aaaa视频 | 怡红院免费全部视频在线视频 | 最近在线观看免费完整视频 | 丁香综合在线 | 麻豆91hd| 国产精品一一在线观看 |