<?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:aop="http://www.springframework.org/schema/aop"
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.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/data/jpa
http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd">

<!-- 配置读取properties文件的工具类 -->
<context:property-placeholder location="classpath:jdbc.properties"/>

<!-- 配置c3p0数据库连接池 -->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="jdbcUrl" value="${jdbc.url}"/>
<property name="driverClass" value="${jdbc.driver.class}"/>
<property name="user" value="${jdbc.username}"/>
<property name="password" value="${jdbc.password}"/>
</bean>

<!-- spring整合jpa配置EntityManagerFactory -->
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource"></property>
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<!-- 声明数据库 -->
<property name="database" value="MYSQL"></property>
<!-- 正向工程 自动创建表 -->
<property name="generateDdl" value="true"></property>
<property name="showSql" value="true"></property>
</bean>
</property>
<property name="packagesToScan">
<list>
<value>com.hm.pojo</value>
</list>
</property>
</bean>

<!-- 配置事务管理器 -->
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory"></property>
</bean>

<!-- 配置开启注解事务处理 -->
<tx:annotation-driven transaction-manager="transactionManager"/>

<!-- 配置springIOC的注解扫描 -->
<context:component-scan base-package="com.hm"/>

<!-- Spring Data JPA 的配置 -->
<!-- 加入命名空间jpa -->
<!-- base-package:扫描dao接口所在的包 -->
<jpa:repositories base-package="com.hm.dao"/>
</beans>

springdata的jpa配置文件application.xml的更多相关文章

  1. Springmvc配置文件application.xml 和 spring-servlet.xml

    文章来源:http://blog.csdn.net/tengdazhang770960436/article/details/48395885 1.SpringMVC 的配置分为两部分 applica ...

  2. JavaEE学习之JPA中配置文件persistence.xml

    下面是我从网上找到的关于JPA配置文件persistence.xml的相关描述: <?xml version="1.0" encoding="UTF-8" ...

  3. Spring------约束导入和application.xml的引入方式

    1.spring约束的导入 2.SSH常用约束 3.application.xml的引入方式 <1.通过ClassPathXmlApplicationContext引入配置文件applicati ...

  4. ssh2的application.xml配置文件配置详解

    ssh2的application.xml配置文件配置详解   1.导入其他的配置文件.在ssh项目中可以导入其他的配置文件,导入的格式为: <import resource="clas ...

  5. springboot中配置文件application.properties的配置详情,数据源配置

    pring Boot使用了一个全局的配置文件application.properties,放在src/main/resources目录下或者类路径的/config下.Sping Boot的全局配置文件 ...

  6. SpringBoot配置文件 application.properties详解

    SpringBoot配置文件 application.properties详解   本文转载:https://www.cnblogs.com/louby/p/8565027.html 阅读过程中若发现 ...

  7. @Value取不到值引出的spring的2种配置文件applicationContext.xml和xxx-servlet.xml

    项目中经常会用到配置文件,定义成properties的形式比较常见,为了方便使用一般在spring配置文件中做如下配置: <context:property-placeholder ignore ...

  8. Spring MVC 配置文件dispatcher-servlet.xml 文件详解

    <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.sp ...

  9. 有关spring-servlet.xml 和 application.xml的配置信息讲解(这两个配置信息的区别在哪里)

    在使用springmvc时需要配置得信息有两个,一个是spring-servlet.xml和applcation.xml: 首先两个文件的的存放位置就有一点的不同(见下图),application.x ...

随机推荐

  1. Latex里面的\newtheorem*{xx}{yy}后面的*是干什么的?

    答案: 加了*表示不标号.例如: 同样使用命令: \begin{prb} xx\end{prb} 1. \newtheorem{prb}{Problem Formulation} → Problem ...

  2. Linux用户以及组的添加与删除

    查看centos中的用户和用户组 1.用户列表文件:/etc/passwd/ 2.用户组列表文件:/etc/group 3.查看系统中有哪些用户: cut -d : -f 1 /etc/passwd ...

  3. beautifulsoup 安装

    pip install beautifulsoup4

  4. vue 2.x 的 v-bind 指令的 .prop 事件修饰符详解

    vue 官方文档对 .prop 修饰符的解释是: 使用例子: 那么,具体的原理和用法是什么呢?这要从 html 的 DOM node 说起. 在 html 标签里,我们可以定义各种 attribute ...

  5. git 撤销修改和版本回退

    1. 工作区 文件只是在工作区进行了修改,还没有提交到暂存区(未进行 git  add 操作) 此时可以使用  git  checkout  --  filename  撤销工作区文件的修改 效果相当 ...

  6. Java Jsch SFTP 递归下载文件夹

    Java Program For Downloading Folder Content recursively from SFTP Server How to download folder from ...

  7. 编写可维护的JavaScript代码(部分)

    平时使用的时VS来进行代码的书写,VS会自动的将代码格式化,所有写了这么久的JS代码,也没有注意到这些点.看了<编写可维护的javascript代码>之后,做了些笔记. var resul ...

  8. Redis内存满了的几种解决方法(内存淘汰策略与Redis集群)

    1,增加内存: 2,使用内存淘汰策略. 3,Redis集群. 重点介绍下23: 第2点: 我们知道,redis设置配置文件的maxmemory参数,可以控制其最大可用内存大小(字节). 那么当所需内存 ...

  9. JDBC——数据库连接池以及JDBC代码模版模版

    该代码模版由三部分组成,一个是数据库连接池,一个是数据库常用操作的模版抽象,还有一个是重写的连接对象,主要重写关闭连接的方法,将其改为释放到连接池. OolongConnectionPool.java ...

  10. android 9.0以上charles https抓包

    以前安装证书的方式无效了,必须将下载的证书复制到/system/etc/security/cacerts/目录, 步骤: 1.现在手机上安装好 chls.pro/ssl下载得到一个 charles-p ...