如果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. 123457123456#0#-----com.threeapp.MakerHanBao01----儿童汉堡制作游戏

    ----com.threeapp.MakerHanBao01----儿童汉堡制作游戏

  2. Delphi中动态加载TreeView信息

    unit Unit3; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms ...

  3. InfluxDB+Grafana大数据监控系列之数据源配置(二)

    一.Grafana 配置 InfluxDB 数据源 1.1 登录 Granfana 界面选择 InfluxDB 数据源 在前面我们已经部署好相应监控环境,登录Grafana:http://10.223 ...

  4. CentOS7.2配置LNMP环境并安装配置网站WordPress

    1,安装环境查看 2,安装MySQL5.7.22 下载MySQL wget https://downloads.mysql.com/archives/get/file/mysql-5.7.22-1.e ...

  5. iOS-UIScrollView滚动视图(转)

    http://blog.csdn.net/iukey/article/details/7319314 UIScrollView 类负责所有基于 UIKit 的滚动操作. 一.创建 CGRect bou ...

  6. Levenberg-Marquardt迭代(LM算法)-改进Guass-Newton法

                  1.前言                                a.对于工程问题,一般描述为:从一些测量值(观测量)x 中估计参数 p?即x = f(p),     ...

  7. python 创建虚拟环境(virtualenv)

    原文地址:https://www.jianshu.com/p/2645d8f2e690 另附连接:Linux环境下虚拟环境virtualenv安装和使用 virtualenv 安装 1.Install ...

  8. springboot下html的js中使用shiro标签功能

    在js中直接使用shiro标签是不行的 比如 下面有个小技巧

  9. 点亮文字(CSS)

    html <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8& ...

  10. 长乐培训Day1

    T1 魔法照片 题目 [题目描述] 如果你看过<哈利·波特>,你就会知道魔法世界里的照片是很神奇的.也许是因为小魔法师佳佳长的太帅,很多人都找他要那种神奇的魔法照片, 而且还都要佳佳和他的 ...