如果applicationContext.xml文件放置在src下面的的时候使用jUint测试的时候编写的路径应该是这样的:

     @Test

 public void saveTest() {

     ApplicationContext ctx = 

         new ClassPathXmlApplicationContext(”applicationContext.xml“);

但是如果applicationContext.xml文件放置在WEB-INF下面的时候使用jUnit测试的时候编写的路径就要有区别了

如果不这样写,测试的时候就会提示applicationContext.xml文件找不到 

 private String conf = "WebRoot/WEB-INF/applicationContext.xml";

 @Test

 public void saveTest(){

     ApplicationContext ac = new FileSystemXmlApplicationContext(conf);     

 } 

转:applicationContext.xml文件放置位置不同而导致的jUnit测试的时候路径的不同的更多相关文章

  1. applicationContext.xml文件放置位置不同而导致的jUnit测试的时候路径的不同

    如果applicationContext.xml文件放置在src下面的的时候使用jUint测试的时候编写的路径应该是这样的: @Test public void testFindByPage() { ...

  2. Spring配置文件详解 - applicationContext.xml文件路径

    spring的配置文件applicationContext.xml的默认地址在WEB-INF下,只要在web.xml中加入代码 org.springframework.web.context.Cont ...

  3. Spring配置文件详解 – applicationContext.xml文件路径

    Spring配置文件详解 – applicationContext.xml文件路径 Java编程                 spring的配置文件applicationContext.xml的默 ...

  4. applicationContext.xml文件如何调用外部properties等配置文件

    只需要在applicationContext.xml文件中添加一行: <!-- 导入外部的properties文件 --> <context:property-placeholder ...

  5. Spring中加载ApplicationContext.xml文件的方式

    Spring中加载ApplicationContext.xml文件的方式 原文:http://blog.csdn.net/snowjlz/article/details/8158560 1.利用Cla ...

  6. Spring MVC框架下在java代码中访问applicationContext.xml文件中配置的文件(可以用于读取配置文件内容)

    <bean id="propertyConfigurer" class="com.****.framework.core.SpringPropertiesUtil& ...

  7. ApplicationContext.xml文件详解

    想必用过Spring的程序员们都有这样的感觉,Spring把逻辑层封装的太完美了(个人感觉View层封装的不是很好).以至于有的初学者都不知道Spring配置文件的意思,就拿来用了.所以今天我给大家详 ...

  8. Spring的applicationContext.xml文件

    以下是详解Spring的applicationContext.xml文件代码:<!-- 头文件,主要注意一下编码 --><?xml version="1.0" e ...

  9. 当你的Spring IOC 容器(即applicationContext.xml文件)忘记配到web.xml 文件中时

    当你的Spring IOC 容器忘记配到web.xml 文件中时,启动服务器就会报错. 部分错误如下: Caused by: org.springframework.beans.factory.NoS ...

随机推荐

  1. PAT 甲级 1052 Linked List Sorting (25 分)(数组模拟链表,没注意到不一定所有节点都在链表里)

    1052 Linked List Sorting (25 分)   A linked list consists of a series of structures, which are not ne ...

  2. LeetCode_125. Valid Palindrome

    125. Valid Palindrome Easy Given a string, determine if it is a palindrome, considering only alphanu ...

  3. ClientDataSet中修改,删除,添加数据和Delta属性

    ClientDataSet中使用Post提交变更的数据时,实际上并没有更新到后端数据库中,而是提交到了由DataSnap管理的数据缓冲区中.当使用了ClientDataSet.ApplyUpDates ...

  4. (一)UML概览

    类图

  5. 微信小程序之对象转化为数组

    对象转成数组方式一(数组里面是一个个number类型的元素) let dictObject= { , , , , }; // 对象转成数组方式一 var createArr = [] for (let ...

  6. wordpress通过$wpdp更新数据表内容

    如下面的代码 更新id为1的数据 table 指的是要更新的数据表 第一个数组 array( 'column1' => 'value1', 'column2' => 'value2' ) ...

  7. 【WPS单元格】汉字转拼音的方法

    昨晚休息的时候,赵 sir发来消息,突然有急事,需要把大批量的单元格汉字名字转换为拼音.迅粗略搜了下百度,发现office Excel 是很方便的,而赵 sir电脑装的是wps.百度了下,发现关于WP ...

  8. 【ARM-Linux开发】ARM板卡上QT显示中文

    平台:Freescale imx6  编译系统:yocto  Qt版本:5.5.1 刚弄了个Qt程序到开发板,发现中文都没有显示,英文可以显示.  就加了个中文字库.DroidSansFallback ...

  9. Python基础——numpy库的使用

    1.numpy库简介:    NumPy提供了许多高级的数值编程工具,如:矩阵数据类型.矢量处理,以及精密的运算库.专为进行严格的数字处理而产生. 2.numpy库使用: 注:由于深度学习中存在大量的 ...

  10. 路由器04--OPKG

    1.简介 https://oldwiki.archive.openwrt.org/doc/techref/opkg Opkg 是一个基于 ipkg 的轻量级的软件包管理系统,主要用于嵌入式系统,目前应 ...