Spring Data JPA设置:匹配的通配符是严格的,但是找不到元素' jpa:repositories'

时间:2014-08-06 20:51:00

标签: spring jpa

我在设置Spring Data JPA时遇到问题。我试图在不使用Maven或Gradle的情况下进行设置,但是在动态Web项目发布时我收到了这个例外:

异常消息:

  

匹配的通配符是严格的,但是找不到声明   元素'jpa:repositories'

背景:

  • Spring Version:3.2
  • 我正在编辑的文件:applicationContext.xml

的applicationContext.xml:

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:p="http://www.springframework.org/schema/p"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:cache="http://www.springframework.org/schema/cache"
       xmlns:jpa="http://www.springframework.org/schema/data/jpa"
       xmlns:repository="http://www.springframework.org/schema/data/repository"
       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/cache 
            http://www.springframework.org/schema/cache/spring-cache-3.2.xsd
            http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
            http://www.springframework.org/schema/data/repository http://www.springframework.org/schema/data/repository/spring-repository.xsd">

...

<jpa:repositories base-package="mypackage.common.service"/>

我不确定问题是什么。名称间距是否存在问题,或者我是否应该包含不属于Spring 3.2核心的Spring Data JPA特定JAR文件?

谢谢!

1 个答案:

答案 0 :(得分:0)

您需要更改

http://www.springframework.org/schema/beans/spring-beans-3.2.xsd

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

它应该有用。