读书人

解决Spring JPA 配置文件在Eclipse下报

发布时间: 2014-04-27 17:46:17 作者: rapoo

新公司工程是用Maven管理的,技术上使用了JPA,但是我导入工程到MyEclipse时,applicationContext.xml中提示错误:

Java代码
  1. Referenced file contains errors (http://www.springframework.org/schema/data/jpa/spring-jpa-1.3.xsd)

网上说需要用到:

Java代码
  1. http://www.springframework.org/schema/data/repository/spring-repository.xsd

于是对配置文件少做修改,不报错,可以运行,修改后的配置文件头如下:

Java代码
  1. <?xml version="1.0" encoding="UTF-8"?>

  2. <beans xmlns="http://www.springframework.org/schema/beans"

  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

  4. xmlns:context="http://www.springframework.org/schema/context"

  5. xmlns:jdbc="http://www.springframework.org/schema/jdbc"

  6. xmlns:jee="http://www.springframework.org/schema/jee"

  7. xmlns:tx="http://www.springframework.org/schema/tx"

  8. xmlns:jpa="http://www.springframework.org/schema/data/jpa"

  9. xmlns:ehcache="http://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring"

  10. xsi:schemaLocation="

  11. http://www.springframework.org/schema/beans

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

  13. http://www.springframework.org/schema/context

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

  15. http://www.springframework.org/schema/jdbc

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

  17. http://www.springframework.org/schema/jee

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

  19. http://www.springframework.org/schema/tx

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

  21. http://www.springframework.org/schema/data/jpa

  22. http://www.springframework.org/schema/data/jpa/spring-jpa-1.3.xsd

  23. http://www.springframework.org/schema/data/repository

  24. http://www.springframework.org/schema/data/repository/spring-repository-1.5.xsd

  25. http://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring

  26. http://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring/ehcache-spring-1.2.xsd"

  27. default-lazy-init="true">

请您到ITEYE网站看 java小强 原创,谢谢!


读书人网 >Eclipse开发

热点推荐