当前位置: 首页 > 知识库问答 >
问题:

发现以元素“jpa:repository”开头的内容无效

牛迪
2023-03-14

我在spring-data-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>

但我有个例外:

共有1个答案

段干俊茂
2023-03-14

简而言之,如果您将http://www.springframework.org/schema/data/jpa/spring-jpa.xsd替换为http://www.springframework.org/schema/data/jpa/spring-jpa-1.1.xsd,就可以解决问题。但我不确定你是否愿意这么做。

原因?标记 在新的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

 类似资料: