【问题标题】:Spring-Data-JPA causes XSD validation error in Spring STS using XML configurationSpring-Data-JPA 使用 XML 配置在 Spring STS 中导致 XSD 验证错误
【发布时间】:2013-02-11 17:33:14
【问题描述】:

Eclipse/STS 同时使用 Spring 3.2.1 和 Spring-data-jpa 报告错误。 我有一些带有以下标头的 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:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:p="http://www.springframework.org/schema/p"
xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xsi:schemaLocation="
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context.xsd
    http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/mvc
    http://www.springframework.org/schema/mvc/spring-mvc.xsd
    http://www.springframework.org/schema/aop
    http://www.springframework.org/schema/aop/spring-aop.xsd
    http://www.springframework.org/schema/data/jpa
    http://www.springframework.org/schema/data/jpa/spring-jpa.xsd">

我正在使用 Spring 3.2.1 和 Spring-Data-JPA 1.3.0 并且 Eclipse/STS 报告了这个:

引用的文件包含错误 (http://www.springframework.org/schema/data/jpa)

这发生在每个包含 data-jpa 模式的 XML 配置文件中。 当我从 XML 配置中删除 JPA 时,一切都很好。

是我的配置错误还是这里发生了什么?

谢谢! 保罗

【问题讨论】:

  • 我得到了同样的结果。我怀疑这是因为 spring 3.2 依赖项导入 spring-tool-3.2 和 spring data xsd 导入 spring-tool.xsd (没有 3.2 后缀)。还是不知道怎么解决

标签: spring spring-data-jpa


【解决方案1】:

今天没有http://www.springframework.org/schema/data/jpa/spring-jpa.xml文件所以你必须使用http://www.springframework.org/schema/data/jpa/spring-jpa-1.3.xsd,但是这个文件使用http://www.springframework.org/schema/data/repository/spring-repository.xsd,它也不存在所以你必须在你的上下文文件中添加这个架构的位置:

xsi:schemaLocation="http://www.springframework.org/schema/beans
                    http://www.springframework.org/schema/beans/spring-beans.xsd
                    http://www.springframework.org/schema/jdbc
                    http://www.springframework.org/schema/jdbc/spring-jdbc-3.2.xsd
                    http://www.springframework.org/schema/data/jpa
                    http://www.springframework.org/schema/data/jpa/spring-jpa-1.3.xsd
                    http://www.springframework.org/schema/data/repository
                    http://www.springframework.org/schema/data/repository/spring-repository-1.5.xsd
                    http://www.springframework.org/schema/jee
                    http://www.springframework.org/schema/jee/spring-jee-3.2.xsd"

【讨论】:

  • 我刚遇到这个问题。感谢分享!
猜你喜欢
  • 1970-01-01
  • 2016-01-30
  • 1970-01-01
  • 1970-01-01
  • 2014-09-22
  • 2012-05-10
  • 2013-01-04
  • 2012-11-30
  • 2018-01-03
相关资源
最近更新 更多