zhangmazi_ 2015-08-10 02:00 采纳率: 0%
浏览 2154

SpringDataJPA 配置出错

配置/jpa:repositories出问题

我的配置文件如下
<?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:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:tool="http://www.springframework.org/schema/tool"
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-4.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-4.0.xsd
http://www.springframework.org/schema/tool
http://www.springframework.org/schema/tool/spring-tool-4.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-4.0.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-1.5.xsd

">

<util:properties id="settings" location="classpath:config.properties"></util:properties>

<context:component-scan base-package="com.stru.*">
    <context:include-filter type="assignable" expression="com.stru.entity.Annimal"/>
    <context:include-filter type="assignable" expression="com.stru.entity.Information"/>
</context:component-scan>

<!-- 自动装配注解Bean后置处理器 -->  
<bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor"/>  

<!-- JPA注解Bean后置处理器 -->  
<bean  class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" /> 

<!-- 开启Spring提供的基于注解的声明式事务管理 --> 
<tx:annotation-driven transaction-manager="transactionManager"/>

<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName" value="#{settings['jdbc.driverClassName']}"></property>
        <property name="url" value="#{settings['jdbc.url']}" />
        <property name="username" value="#{settings['jdbc.username']}" />
        <property name="password" value="#{settings['jdbc.password']}" />
</bean>




<!-- JPA START -->

<bean id="jpaVendorAdapter" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
    <property name="database" value="#{settings['jpa.database']}"></property>
    <property name="showSql" value="true"></property>
    <property name="generateDdl" value="false"></property>
    <property name="databasePlatform" value="org.hibernate.dialect.MySQLDialect"></property>
</bean>

<bean id="entityManager" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
    <property name="dataSource" ref="dataSource"></property>
    <property name="jpaVendorAdapter" ref="jpaVendorAdapter"></property>
</bean>


 <!-- 声明一个Spring提供的JPA事务管理器,传入的参数是Spring中的实体管理器工厂 -->  
<bean id="transactionManager"
    class="org.springframework.orm.jpa.JpaTransactionManager">
    <property name="entityManagerFactory" ref="entityManager" />
</bean> 


<jpa:repositories base-package=""></jpa:repositories>
  • 写回答

1条回答

  • JPF1024 2015-08-10 02:26
    关注

    什么错误?。。。。。。。。。。。。。。。

    评论

报告相同问题?

悬赏问题

  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类