<?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/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
">
<!-- 配置SessionFactory -->
<context:component-scan base-package="com.shop" />
<!--
<context:property-placeholder location="classpath:MySqljdbc.properties" />
-->
<context:property-placeholder location="classpath:SQLjdbc.properties" />
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="${driverClass}" />
<property name="url" value="${jdbcUrl}" />
<property name="username" value="${user}" />
<property name="password" value="${password}" />
<!-- 连接池启动时的初始值 -->
<property name="initialSize" value="1" />
<!-- 连接池的最大值 -->
<property name="maxActive" value="500" />
<!-- 最大空闲值.当经过一个高峰时间后,连接池可以慢慢将已经用不到的连接慢慢释放一部分,一直减少到maxIdle为止 -->
<property name="maxIdle" value="2" />
<!-- 最小空闲值.当空闲的连接数少于阀值时,连接池就会预申请去一些连接,n以免洪峰来时来不及申请 -->
<property name="minIdle" value="1" />
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="mappingDirectoryLocations">
<list>
<value>classpath:/com/shop/vo</value>
</list>
</property>
<property name="hibernateProperties">
<value>
hibernate.dialect=org.hibernate.dialect.SQLServerDialect
<!--hibernate.dialect=org.hibernate.dialect.MySQLDialect-->
hibernate.hbm2ddl.auto=create
hibernate.show_sql=true
hibernate.format_sql=true
<!--
配置缓存Cache hibernate.current_session_context_class=thread
hibernate.cache.use_second_level_cache=true
hibernate.cache.use_query_cache=true
hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider
-->
hibernate.cache.use_second_level_cache=true
hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider
hibernate.cache.use_query_cache=true
</value>
</property>
<!--
<property name="cacheQueries"> <value>true</value> </property>
-->
</bean>
<!-- 配置事务管理器 -->
<bean id="txManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>
<!-- 事务的传播特性 -->
<tx:advice id="txAdvice" transaction-manager="txManager">
<tx:attributes>
<tx:method name="add*" propagation="REQUIRED" />
<tx:method name="del*" propagation="REQUIRED" />
<tx:method name="update*" propagation="REQUIRED" />
<tx:method name="save*" propagation="REQUIRED" />
<tx:method name="load*" propagation="REQUIRED" />
</tx:attributes>
</tx:advice>
<!-- 那些类那些方法使用事务 -->
<aop:config>
<aop:pointcut id="allManagerMethod" expression="execution(* com.shop.dao..*.*(..))" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="allManagerMethod" />
</aop:config>
</beans>
分享到:
相关推荐
Spring配置 Spring 配置 映射 加注释!!!!Spring配置 Spring 配置 映射 加注释!!!!
spring配置文件实例
spring配置 spring配置 spring配置 spring配置 spring配置
ssmspring配置ssmspring配置ssmspring配置ssmspring配置ssmspring配置ssmspring配置ssmspring配置ssmspring配置ssmspring配置ssmspring配置ssmspring配置ssmspring配置ssmspring配置ssmspring配置ssmspring配置ssm...
使用Spring配置文件实现AOP
Spring配置文件集合Spring配置文件集合Spring配置文件集合Spring配置文件集合Spring配置文件集合Spring配置文件集合Spring配置文件集合
spring 配置文件 归类 IOC AOPspring 配置文件 归类 IOC AOP
spring配置最佳实践.zip spring配置最佳实践.zip spring配置最佳实践.zip
J2EE javascrip 基础知识,MVC spring 配置
spring 配置c3p0 的配置文件 注意是 配置文件
1.创建web工程 2.导入jar ...3.导入配置文件 spring-framework-2.5.6\samples\jpetstore\war\WEB-INF\log4j.properties spring-framework-2.5.6\samples\jpetstore\war \WEB-INF\applicationContext.xml
spring配置JNDI数据源
连接MYSQL数据库,SPRING配置文件示例。
spring配置文件详解,Spring的applicationContext.xml文件代码:
spring配置文件加密实现
spring配置文件详解,交你如何理解spring,熟练运用spring
spring配置文件spring配置文件spring配置文件spring配置文件spring配置文件spring配置文件spring配置文件spring配置文件spring配置文件spring配置文件spring配置文件spring配置文件spring配置文件spring配置文件...
spring配置的简单案例.zip spring配置的简单案例.zip spring配置的简单案例.zip spring配置的简单案例.zip spring配置的简单案例.zip spring配置的简单案例.zip spring配置的简单案例.zip spring配置的简单案例.zip ...
Spring配置全书 关于Spring的配置 Spring Framework总是不断的改变着Java企业开发的方向,它用一种松耦合的方式来配置和组装应用程序对象和业务对象,比以往的Java企业开发来的更加简洁。一旦你开发了基于Spring...
spring 配置 文件