Spring+publicId+と+systemid+の間にスペースが必要です。

3825 ワード

今日は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で、後は1つはSystemIdで、1つの対応ので、位置は逆さまにすることができません。
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       ">
黒い部分は私の記憶に残る部分で、順番が逆です。