<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context"
xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
<!-- 配置属性覆盖器 ,可以将数据库的配置信息配置到properties中,便于阅读、修改和维护-->
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="ignoreUnresolvablePlaceholders" value="true"/>
<property name="locations">
<list>
<value>classpath:jdbc.properties</value>
</list>
</property>
</bean>
<!-- 数据源 -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="${jdbc.driverClassName}"/>
<property name="url" value="${jdbc.url}"/>
<property name="username" value="${jdbc.username}"/>
<property name="password" value="${jdbc.password}"/>
</bean>
<!-- 配置hibernate会话工厂以及hibernate属性 -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<!-- xml实体映射使用
<property name="mappingLocations">
<value>classpath*:/org/ltsh/**/*.hbm.xml</value>
</property>
-->
<property name="packagesToScan">
<list>
<value>com.test.model</value>
</list>
</property>
<property name="hibernateProperties">
<value>
hibernate.dialect = org.hibernate.dialect.Oracle10gDialect
hibernate.hbm2ddl.auto = update
hibernate.show_sql=true
</value>
</property>
</bean>

<bean id="hibernateTemplate" class="org.springframework.orm.hibernate4.HibernateTemplate">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>

<!-- 默认的注解映射的支持 -->
<context:annotation-config />
<context:component-scan base-package="com.test" /> <!-- 自动扫描该包路径下的所有注解 -->

<!-- 事务配置 -->
<!-- 定义事务管理器 -->
<bean id="transactionManager"
class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>

</beans>

最新文章

  1. NGUI 屏幕自适应
  2. c++ Primer 第四版 第一阶段 const总结
  3. being词典案例分析
  4. weka平台下手动造.arff的数据
  5. 二层安全之MAC Flooding解析与解决方法
  6. Hibernate学习笔记--环境搭建及运行
  7. 使用winform控件注意线程绘制界面冲突
  8. 定制jackson的自定义序列化(null值的处理)
  9. 使用Nuget管理dll
  10. Java生产1-100的随机数
  11. sublime自动保存(失去焦点自动保存)
  12. 洛谷P2050 [NOI2012]美食节
  13. 2015多校联赛 ——HDU5288(数学)
  14. 史上最污技术解读,让你秒懂IT术语(转载)
  15. 论文阅读:Prominent Object Detection and Recognition: A Saliency-based Pipeline
  16. 选择、操作web元素-3
  17. SQL常用增删改查
  18. windows 下 MySql5.6主从复制
  19. Java查看内部类信息
  20. windows下用python转换markdown到html

热门文章

  1. HTML5设计原理
  2. 重学JAVA基础(一):PATH和CLASSPATH
  3. Linux中的nc测试端口是否开放
  4. &lt;正则吃饺子&gt; :关于redis集群的测试demo
  5. netstat -st输出解析(二)
  6. Working Experience - WPF 中 DataGrid 控件的应用
  7. Unity手游之路自动寻路Navmesh之高级主题
  8. 洛谷P1031 均分纸牌
  9. MyBatis入门学习笔记(一)
  10. jQuery EasyUI/TopJUI上传多个附件并可以进行删除操作