我有一个项目使用 Spring (context, transaction, apect) 4.1.6.RELEASE 和 spring-data-jpa 1.8.0.RELEASE 并遇到奇怪的错误,假设是由 xsd 验证引起的。但是,我无法找出原因。奇怪的是,项目运行良好,我所有的 bean 都被正确识别。
我正在使用 Eclipse luna 和 Spring Tools Suite 插件
我删除了我的 applicationContext.xml 中的所有内容,除了导致问题的“jpa:”行。 xml 已使用 STS 插件创建。
我试图从 xsds 中删除版本号,但没有成功。
最佳答案
我前段时间遇到了同样的问题,都是jpa的东西导致的错误 我将 jpa 配置移到了一个新的配置文件中
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
default-destroy-method="destroy"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd
http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa-1.8.xsd">
<context:component-scan base-package="com.some.validator" />
<context:component-scan base-package="com.some.security.rest" />
<jpa:repositories base-package="com.some.repository.path"
entity-manager-factory-ref="entityManagerFactory" />
</beans>
一些 maven 导入:
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>1.8.2.RELEASE</version>
</dependency>
和spring框架版本
<org.springframework-version>4.1.7.RELEASE</org.springframework-version>
尝试清理项目并使用 maven 更新它
关于xml - Spring 数据 xml 配置模式验证错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33430658/