2013-01-02 47 views
1

我在彈簧數據的JPA使用:無效的含量被發現開始元素「JPA:倉庫」

<beans xmlns="http://www.springframework.org/schema/beans" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" 
xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:jee="http://www.springframework.org/schema/jee" 
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jpa="http://www.springframework.org/schema/data/jpa" 
xsi:schemaLocation=" 
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd 
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd 
    http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.2.xsd 
    http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.2.xsd 
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd 
    http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd" 
default-lazy-init="true"> 

<jpa:repositories base-package="org.kb" repository-impl-postfix="Impl"> 
<jpa:repository id="articleDao" repository-impl-ref="articleDaoPlus" /> 
</jpa:repositories> 

,但我得到了異常:

嵌套的例外是org.xml.sax中的.SAXParseException:cvc-complex-type.2.4.a:從元素'jpa:repository'開始找到無效的內容。 '{「http://www.springframework.org/schema/data/repository":include-filter,」http://www.springframework.org/schema/data/repository":exclude-filter}'之一是預期。

+0

的可能重複的[調度員的servlet:無效內容被發現與元件「庫」開始(http://stackoverflow.com/questions/10600861 /調度程序-servlet的無效化內容被發現的啓動與 - 元件repositorie) – mgibsonbr

回答

3

總之如果你用http://www.springframework.org/schema/data/jpa/spring-jpa-1.1.xsd代替http://www.springframework.org/schema/data/jpa/spring-jpa.xsd,它會解決問題。但我不確定你會這麼做。

原因?標籤<jpa:repository id="articleDao" repository-impl-ref="articleDaoPlus" />在新的spring-data-jpa版本中被刪除。

看一看的差之間的兩條的XSD即http://www.springframework.org/schema/data/jpa/spring-jpa.xsdhttp://www.springframework.org/schema/data/jpa/spring-jpa-1.1.xsd

相關問題