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
    关注

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

    评论

报告相同问题?

悬赏问题

  • ¥50 comsol稳态求解器 找不到解,奇异矩阵有1个空方程返回的解不收敛。没有返回所有参数步长;pid控制
  • ¥15 怎么让wx群机器人发送音乐
  • ¥15 fesafe材料库问题
  • ¥35 beats蓝牙耳机怎么查看日志
  • ¥15 Fluent齿轮搅油
  • ¥15 八爪鱼爬数据为什么自己停了
  • ¥15 交替优化波束形成和ris反射角使保密速率最大化
  • ¥15 树莓派与pix飞控通信
  • ¥15 自动转发微信群信息到另外一个微信群
  • ¥15 outlook无法配置成功