今天配置Spring,遇到一个很奇葩的问题:

Spring.xml的配置文件内容:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/context/spring-context.xsd
">

测试出错:

Tests in error:
instanceSpring(com.qunar.studyspring.SpringTest): Line 1 in XML document from class path resource [spring.xml] is invalid; nested exception is org.xml.sax.SAXParseException; systemId: http://www.springframework.org/schema/tx/; lineNumber: 1; columnNumber: 55; 在 publicId 和 systemId 之间需要有空格。

百思不得其解,后来在网络上搜索了半天,结论就是:前一个是publicID,后一个是SystemId,是一一对应的,位置不能颠倒

http://www.springframework.org/schema/beans publicID
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd SystemId

修改之后:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
">

黑色部分就是给我留下深刻记忆的部分,次序颠倒了

Spring 在+publicId+和+systemId+之间需要有空格的更多相关文章

  1. 在 publicId 和 systemId 之间需要有空格。

    spring  applicationContext_datasource.xml中约束错误 org.springframework.beans.factory.xml.XmlBeanDefiniti ...

  2. Spring- 异常org.xml.sax.SAXParseException; systemId: http://www.springframework.org/schema/context/; lineNumber: 1; columnNumber: 55; 在 publicId 和 systemId 之间需要有空格。

    抛出异常 六月 03, 2018 7:40:44 下午 org.springframework.context.support.AbstractApplicationContext prepareRe ...

  3. spring 自定义schema 加载异常 White spaces are required between publicId and systemId.

    spring 项目启动报错 报错日志如下: Caused by: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreExcepti ...

  4. requests(二): json请求中固定键名顺序&消除键和值之间的空格

    继上一篇requests发送json请求的文章后,实际工作中遇到了以下2种情况. 1:服务端要求json字符串,键名的顺序固定  2.服务端对于接收到的json数据中,若key和value之间有空格, ...

  5. xml操作-Nested exception: org.xml.sax.SAXParseException: White spaces are required between publicId and systemId. 异常处理

    异常如下: org.dom4j.DocumentException: Error on line 2 of document file:///D:/workspaces/struts2/lesson0 ...

  6. 正则去掉html标签之间的空格、换行符、tab符,但是保留html标签内部的属性空格

    今天遇到一个比较少见的去空格: 正则去掉html标签之间的空格.换行符.tab符,但是保留html标签内部的属性空格 JS 举例: "<a href='baidu.com' name= ...

  7. css选择器之间的 空格和逗号

    当两个选择器之间有空格的情况下,代表的是子类选择器 .a .b{} 代表的是a类的b子类 而两个选择器之间没有空格的情况下,代表的是同时拥有两个类名的标签 <div class="a ...

  8. HTML行内级元素之间的空格问题

    HTML行内级元素之间的空格问题 1.为什么元素之间会产生空格? 在编写行内级元素(包括inline-block元素)的代码之间如果有空格(换行),在浏览器上就会显示元素之间有空格. 示例代码如下: ...

  9. spring4笔记----报错publicid systemid之间要有空格的解决方法

    <?xml version="1.0" encoding="GBK"?> <beans xmlns:xsi="http://www. ...

随机推荐

  1. Unity 动画知识之一

    Unity现在已经用的很广泛啦,可是却一直没有什么美术向的教程. 程序用方面的内容在各个论坛都有讨论,但是美术似乎很弱势啊. 明明美术也很需要掌握引擎方面的内容嘛! 山谷里的野百合还有春天呢 我们美术 ...

  2. JAVA8 List排序

    先定义一个实体类 @Data @AllArgsConstructor @NoArgsConstructor public class Human { private String name; priv ...

  3. 设置Images.xcassets后启动仍旧黑屏的问题

    换了XCode6之后,发现以前写Icon-76.png这样很麻烦,就使用了Image.xcassets,公司所有测试机跑了一下,发现没什么问题.唯独有一台设置有问题,iphone5 ios6.0系统, ...

  4. bash 设置

    export COLUMNS=500 $* 将所有命令行参数当做单个文本值包含 $@ 将所有命令行参数当做独立的文本值包含 $# 命令行参数数目 $? 最近使用的前端进程的退出状态码 $- 当前命令选 ...

  5. 得到ImageView中drawable显示的区域的计算方法

    我们都知道Imageview中有不同的拉伸比率,比如fitStart,centCrop这样的,所以imageview中的drawable不一定和imageview占有相同的位置和大小,那么怎么计算呢? ...

  6. 机器翻译评价指标之BLEU详细计算过程

    原文连接 https://blog.csdn.net/guolindonggld/article/details/56966200 1. 简介 BLEU(Bilingual Evaluation Un ...

  7. jquery fullPage

    FROM : http://www.dowebok.com/77.html 应用: http://txhd.163.com/

  8. 输入两个很大的正数(用C字符串表示),输出他们的乘积,将设不考虑非法输入。

    #include<iostream> #include<cassert> void multiply(const char *a,const char *b) { assert ...

  9. @Param注解在Mybatis中的使用 以及传递参数的三种方式

    第一种: Dao层的方法 public User selectUser(String name,String password); 对应的Mapper.xml <select id=" ...

  10. NVelocity语法常用指令

    对变量的引用:$ [ ! ][ { ][ a..z, A..Z ][ a..z, A..Z, 0..9, -, _ ][ } ]. 在NVelocity中,对变量的引用都是以$开头加上变量名称.当使用 ...