Spring beans.xml(applicationContext.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:p="http://www.springframework.org/schema/p"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context" 
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd ">
<context:component-scan base-package="util.base"/>
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="driverClass" value="net.sourceforge.jtds.jdbc.Driver"></property>
<!-- <property name="jdbcUrl" value="jdbc:jtds:sqlserver://192.168.0.1:1124/saa;charset=gbk;SelectMethod=CURSOR"></property> -->
<property name="jdbcUrl" value="jdbc:jtds:sqlserver://192.168.0.1:1124/aa;charset=gbk;SelectMethod=CURSOR;useLOBs=false"></property>
<property name="user" value="sa"></property>
<property name="password" value="111111"></property>
<!-- 连接池配置 -->
<property name="minPoolSize"><value>2</value></property>
  <property name="maxPoolSize"><value>100</value></property>
<property name="maxIdleTime"><value>1800</value></property>
  <property name="acquireIncrement"><value>2</value></property>
  <property name="maxStatements"><value>0</value></property>
  <property name="initialPoolSize"><value>2</value></property>
  <property name="idleConnectionTestPeriod"><value>1800</value></property>
  <property name="acquireRetryAttempts"><value>30</value></property>
  <property name="breakAfterAcquireFailure"><value>true</value></property>
  <property name="testConnectionOnCheckin"><value>true</value></property>
  <property name="testConnectionOnCheckout"><value>true</value></property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="hibernateProperties">
             <props>
              <prop key="hibernate.dialect">org.hibernate.dialect.SQLServer2008Dialect</prop>
<!-- 解决no session found -->
<!-- <prop key="hibernate.current_session_context_class">
thread
</prop> -->
                <prop key="hibernate.hbm2ddl.auto">update</prop>
                <prop key="hibernate.show_sql">true</prop>
                <!-- hibernate二级缓存的配置 -->
                <!--  
                <prop key="hibernate.cache.use_second_level_cache">true</prop>
                <prop key="hibernate.cache.provider_class">net.sf.ehcache.hibernate.EhCacheProvider</prop>
                <prop key="hibernate.cache.use_query_cache">true</prop>
                -->
             </props>
          </property>
<property name="mappingDirectoryLocations">
<list>
<value>classpath:pt/pojo</value>
<value>classpath:que/pojo</value>
</list>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">  
    <property name="sessionFactory" ref="sessionFactory"/>  
    </bean>
    <tx:advice id="txAdvice" transaction-manager="transactionManager"> 
        <tx:attributes> 
            <tx:method name="exists" read-only="true" />  
          <tx:method name="save*" propagation="REQUIRED" />    
        <tx:method name="add*" propagation="REQUIRED" />    
          <tx:method name="create*" propagation="REQUIRED" />    
          <tx:method name="insert*" propagation="REQUIRED" />    
          <tx:method name="update*" propagation="REQUIRED" />    
          <tx:method name="merge*" propagation="REQUIRED" />    
          <tx:method name="del*" propagation="REQUIRED" />    
          <tx:method name="remove*" propagation="REQUIRED" />    
          <tx:method name="put*" propagation="REQUIRED" />    
          <tx:method name="use*" propagation="REQUIRED"/>    
          <tx:method name="get*" propagation="REQUIRED" />    
          <tx:method name="count*" propagation="REQUIRED" read-only="true" />    
          <tx:method name="find*" propagation="REQUIRED" read-only="true" />    
          <tx:method name="list*" propagation="REQUIRED" read-only="true" />   
          <tx:method name="*" propagation="REQUIRED" />              
        </tx:attributes> 
    </tx:advice>
<aop:config>
<aop:advisor advice-ref="txAdvice" pointcut="execution(* *..*Service.*(..))"/>
</aop:config>
    
<import resource="classes/conf/app-dao.xml"/>
<import resource="classes/conf/app-service.xml"/>
<import resource="classes/conf/app-action.xml"/>
<import resource="classes/conf/app-dwr.xml"/>
<import resource="classes/conf/xfire-servlet.xml"/>

</beans>


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值