<?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"
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/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
<context:component-scan base-package="com.zyn"></context:component-scan>
<!-- 定义受环境影响易变的变量 -->
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
<property name="ignoreResourceNotFound" value="true" />
<property name="locations">
<list>
<!-- 本地开发环境配置 -->
<value>classpath*:/application.local.properties</value>
<!-- 集群中节点配置 -->
<value>classpath*:/application.cluster.properties</value>
<!-- 标准配置 -->
<value>classpath*:/application.properties</value>
<!-- 服务器生产环境配置 -->
<!-- <value>file:/var/myapp/application.server.properties</value> -->
</list>
</property>
</bean>
<!-- c3p0 -->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<property name="driverClass" value="${jdbc.driver}"></property>
<property name="jdbcUrl" value="${jdbc.url}"></property>
<property name="user" value="${jdbc.username}"></property>
<property name="password" value="${jdbc.password}"></property>
</bean>
<!-- <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="${jdbc.driver}"> </property> <property
name="url" value="${jdbc.url}"> </property> <property name="username" value="${jdbc.username}">
</property> <property name="password" value="${jdbc.password}"> </property>
</bean> -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
<prop key="current_session_context_class">thread</prop>
<prop key="hibernate.hbm2ddl.auto">${hibernate.auto}</prop>
<prop key="hibernate.connection.provider_class">{hibernate.connection.provider_class}</prop>
<prop key="hibernate.search.default.directory_provider">org.hibernate.search.store.FSDirectoryProvider</prop>
<prop key="hibernate.search.default.indexBase">F:/temp/index</prop>
</props>
</property>
<property name="annotatedClasses">
<list>
<value>com.zyn.ssh.pojo.Student</value>
</list>
</property>
</bean>
<!-- 事务管理器配置,单数据源事务 -->
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<!-- 使用annotation定义事务 -->
<tx:annotation-driven transaction-manager="transactionManager"
proxy-target-class="true" />
</beans>
application.properties
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/zyn?useUnicode=true&characterEncoding=utf-8
hibernate.dialect=org.hibernate.dialect.MySQLDialect
jdbc.username=root
jdbc.password=admin
pool.initialSize=20
pool.maxActive=40
pool.maxIdle=5
pool.maxWait=600
pool.poolPreparedStatements=false
pool.defaultAutoCommit=false
pool.timeBetweenEvictionRunsMillis=3600000
pool.minEvictableIdleTimeMillis=3600000
#hibernate c3p0 settings
c3p0.acquireIncrement=1
c3p0.maxIdleTime=60
c3p0.maxPoolSize=10
c3p0.minPoolSize=2
c3p0.initialPoolSize=5
#hibernate settings
hibernate.show_sql=true
hibernate.format_sql=false
hibernate.auto=update
hibernate.ehcache_config_file=ehcache.xml
hibernate.connection.provider_class=org.hibernate.connection.C3P0ConnectionProvider
hibernate.jdbc.batch_size=20
分享到:
相关推荐
基于SpringMVC以及Spring,Hibernate的非注解入门小demo
Spring3Annotation+Struts2Annotation+Hibernate3Annotation 全注解集成开发,操作Emp表
hibernate-4.3.5 与Spring(Spring MVC4.0.4)注解方式集成 样例源码
Struts2.3.28+spring4.1.6+hibernate4.3.8整合总结(注解),测试环境使用myeclipse2014,jdk1.6
<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=...
springmvc spring3 hibernate4 log4j 完整的注解配置 spring切面自动打日志等,需要自己建一个小表 可运行 并且已经将bootstrap集成进去.
Struts2.1.6+Spring2.5.6+Hibernate3.3.1全注解实例详解,包含ssh最新框架的集成,IOC注入,AOP面向切面编程.
5.单数据源配置(兼容Tomcat和Weblogic)。 6.Hibernate继承 HibernateDaoSupport。 7.Spring+Junit4单元测试,优点:不会破坏数据库现场,等等。 2)Demo 导入说明: 1.Eclipse Encoding:GBK 2.Eclipse 导入后可能...
框架版本:struts2.2.1、spring2.5.6、hibernate3.6.0.Final,全注解方式。 内容齐全下载后即可运行,注意Demo使用eclipse开发的。功能比较简单。
该demo集成了spring+springmvc+hibernate框架,里面的dao、service、entity均采用注解形式,容易开发,另外该demo中dao采用注解形式,将所有实体dao需要用到的通用方法如insert,update,delete,分页查询等均采用...
本版本全面更新了jar包,全部使用了当前最新版本的jar包,struct2.1.8 spring3 hibernate3.5,全面使用注解取代xm的l配置。 另外增加了一个ant构建脚本,支持使用hudson完成每日构建,持续集成,自动测试,代码规范...
基于spring注解的SSH2框架集成,struts2-2.1 ,hibernate 3.3 ,spring3.1.0
NULL 博文链接:https://cmm.iteye.com/blog/434950
spring集成hibernate,包括所有的jar包和代码而且有注释,使用的是spring注解注入,导入Eeclipse就能运行。
maven管理项目+springmvc+spring+hibernate+freemarker 集成框架。其中注解格式清晰,hibernate进行了代码封装,对开发效率有了提高,对异常进行了封装。freemarker也有优化,参考common包下。对日期工具类有各种...
基于 spring2.5 hibernate3.3 jpa 的annotation注解来减少配置文件的大小 通过jersey实现restful形式请求
搭建和配置Spring与Hibernate整合的环境 26.Spring集成的Hibernate编码与测试 27.Struts与Spring集成方案1(Struts集成Spring) 28.Struts与Spring集成方案2(Spring集成Struts) 29.为Spring集成的Hibernate配置二...
本版本全面更新了jar包,全部使用了当前最新版本的jar包,struct2.1.8 spring3 hibernate3.5,全面使用注解取代xm的l配置。 另外增加了一个ant构建脚本,支持使用hudson完成每日构建,持续集成,自动测试,代码规范...
配置与注解:理解Spring的XML配置和注解配置,并能够在这两种配置方式中进行选择。 Spring AOP与AspectJ:理解Spring AOP的概念,以及如何使用AspectJ实现AOP。 Spring与其它技术集成:了解Spring与其它技术的集成,...