springdata的jpa配置文件application.xml
<?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的更多相关文章
- Springmvc配置文件application.xml 和 spring-servlet.xml
文章来源:http://blog.csdn.net/tengdazhang770960436/article/details/48395885 1.SpringMVC 的配置分为两部分 applica ...
- JavaEE学习之JPA中配置文件persistence.xml
下面是我从网上找到的关于JPA配置文件persistence.xml的相关描述: <?xml version="1.0" encoding="UTF-8" ...
- Spring------约束导入和application.xml的引入方式
1.spring约束的导入 2.SSH常用约束 3.application.xml的引入方式 <1.通过ClassPathXmlApplicationContext引入配置文件applicati ...
- ssh2的application.xml配置文件配置详解
ssh2的application.xml配置文件配置详解 1.导入其他的配置文件.在ssh项目中可以导入其他的配置文件,导入的格式为: <import resource="clas ...
- springboot中配置文件application.properties的配置详情,数据源配置
pring Boot使用了一个全局的配置文件application.properties,放在src/main/resources目录下或者类路径的/config下.Sping Boot的全局配置文件 ...
- SpringBoot配置文件 application.properties详解
SpringBoot配置文件 application.properties详解 本文转载:https://www.cnblogs.com/louby/p/8565027.html 阅读过程中若发现 ...
- @Value取不到值引出的spring的2种配置文件applicationContext.xml和xxx-servlet.xml
项目中经常会用到配置文件,定义成properties的形式比较常见,为了方便使用一般在spring配置文件中做如下配置: <context:property-placeholder ignore ...
- Spring MVC 配置文件dispatcher-servlet.xml 文件详解
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.sp ...
- 有关spring-servlet.xml 和 application.xml的配置信息讲解(这两个配置信息的区别在哪里)
在使用springmvc时需要配置得信息有两个,一个是spring-servlet.xml和applcation.xml: 首先两个文件的的存放位置就有一点的不同(见下图),application.x ...
随机推荐
- docker启动、关闭、重启命令
docker启动命令,docker重启命令,docker关闭命令 启动 systemctl start docker守护进程重启 sudo systemctl daemon-relo ...
- SCOI2009迷路
当初学矩阵幂的时候弃掉了,那时候只会用矩阵优化递推,碰到这种图论的瞬间躺地. 昨天听学长的课,有一道例题,在边权为一的图上求从某点到某点的路径方案数,只要对邻接矩阵跑qpow就完事了. 于是自己画了个 ...
- c++ 派生类的构造函数 与 基类构造函数的关系
<面向对象程序设计基础(第二版>李师贤等,第254页:C++语言的基本规则是:创建一个派生类的对象时,如果基类带有构造函数,则先调用基类的构造函数,然后才调用派生类的构造函数. <T ...
- SpringMVC——Servlet容器启动时初始化SpringMVC应用的原理
在 Servlet 3.0标准中含有一个 ServletContainerInitializer接口,所有实现了这个接口的类会在容器启动的时候得到一个通知,并且会调用其 onStartup()方法,这 ...
- 理解MVC/MVP/MVVM的区别
转载至[http://www.ruanyifeng.com/blog/2015/02/mvcmvp_mvvm.html] MVC 所有的通信都是单向的. M(Model)V(View)C(Contro ...
- OpenCV学习笔记(15)——更多的轮廓函数
凸缺陷,以及如何找到凸缺陷 找某一点到一个多边形的最短距离 不同形状的匹配 1.凸缺陷 前面已经设计了轮廓的凸包和凸性缺陷的概念.OpenCV中有一个函数cv2.convexityDefect()可以 ...
- 1-mybatis-概览
mybatis 当前包如下: 1 annotations 注解相关配置 2 binding 绑定 3 builder 建造器, 主要使用的建造者模式 4 cache 缓存相关 5 cursor 游标 ...
- LC 652. Find Duplicate Subtrees
Given a binary tree, return all duplicate subtrees. For each kind of duplicate subtrees, you only ne ...
- bloomberg learning
https://libguides.ust.hk/c.php?g=208028&p=1372192 Introduction to Bloomberg Professional Bloombe ...
- mongodb游标的使用
1.插入数据 ;i<;i++){ db.shop.insert({_id:i+,name:+i}) } 2.查看数据数 db.shop.find().count() 3.获取游标.判断是否还存在 ...