• Spring 配置 Spring JPA 发生错误的解决方法


    今天在项目的applicationContext.xml中配JPA时

    <?xml version="1.0" encoding="UTF-8"?>
    <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-1.3.xsd"
        default-lazy-init="true">
    </beans>

    Eclipse提示:

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

    google 之,发现 http://www.springframework.org/schema/data/jpa/spring-jpa-1.3.xsd 需要使用到 http://www.springframework.org/schema/data/repository/spring-repository.xsd

    将配置文件修改为:

    <?xml version="1.0" encoding="UTF-8"?>
    <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-1.3.xsd
            http://www.springframework.org/schema/data/repository
                        http://www.springframework.org/schema/data/repository/spring-repository-1.5.xsd
            "
        default-lazy-init="true">
    
    </beans>

    OK!错误提示消失!

  • 相关阅读:
    php json_encode怪问题
    给phpcms v9添加热门搜索关键词
    magento 1.6 后台无法登录解决办法
    08 baidu QA
    java exception
    java thread / process / thread runnable / thread sleep / thread run
    java reflect
    db sysbase
    内存单元
    分段的方式来管理内存
  • 原文地址:https://www.cnblogs.com/williamchang/p/3397926.html
Copyright © 2020-2023  润新知