applicationContext.xml

<pre name="code" class="html"><?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:cache="http://www.springframework.org/schema/cache"
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.2.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd
http://www.springframework.org/schema/cache
     http://www.springframework.org/schema/cache/spring-cache-3.2.xsd
http://www.springframework.org/schema/context 
     http://www.springframework.org/schema/context/spring-context-3.2.xsd">

<!-- 加载jdbc配置文件 -->
<bean id="configBean" 
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> 
<property name="locations"> 
<list>
<value>classpath:jdbc.properties</value>
<value>classpath:sysConfig.properties</value>
</list>
</property>
    </bean>
<!-- 数据源 -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" 
destroy-method="close">
<!-- 驱动 -->
<property name="driverClassName" value="${driverClassName}"/>
<!-- URL -->
<property name="url" value="${url}"/>
<!-- 用户名 -->
<property name="username" value="${username}"/>
<!-- 密码 -->
<property name="password" value="${password}"/>
<!-- 连接池的初始大小 -->
<property name="initialSize" value="${initialSize}" />
<!-- 最大连接数 -->
<property name="maxActive" value="${maxActive}" />
<!-- 最大空闲连接数 -->
<property name="maxIdle" value="${maxIdle}" />
<!-- 最小空闲连接数 -->
<property name="minIdle" value="${minIdle}" />
<!-- 超时等待时间(以毫秒为单位) -->
<property name="maxWait" value="${maxWait}" />
<!-- 在空闲连接回收器线程运行期间休眠的时间值,以毫秒为单位.  -->  
        <property name="timeBetweenEvictionRunsMillis" value="${timeBetweenEvictionRunsMillis}" />  
        <!-- 检查空闲连接的时间间隔 -->  
        <property name="minEvictableIdleTimeMillis" value="${minEvictableIdleTimeMillis}" /> 
</bean>

<!-- 扫描包,controller不扫描 -->
<context:component-scan base-package="com.dg11185.ipost">
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>

<!-- 缓存配置 -->
<aop:aspectj-autoproxy proxy-target-class="true"/>  
<cache:annotation-driven cache-manager="cacheManager"/>
<bean id="cacheManagerFactory" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
<property name="configLocation" value="classpath:ehcache.xml"></property>
</bean>
<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager">
<property name="cacheManager" ref="cacheManagerFactory"></property>
</bean>

<!-- 事务 -->
<!-- 事务配置 -->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
<tx:advice id="tx" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="add*" propagation="REQUIRED" />
<tx:method name="insert*" propagation="REQUIRED" />
<tx:method name="save*" propagation="REQUIRED" />
<tx:method name="delete*" propagation="REQUIRED" />
<tx:method name="remove*" propagation="REQUIRED" />
<tx:method name="update*" propagation="REQUIRED" />
<tx:method name="get*" propagation="NOT_SUPPORTED"/>
<tx:method name="load*" propagation="NOT_SUPPORTED"/>
<tx:method name="find*" propagation="NOT_SUPPORTED" />
<tx:method name="*" propagation="NOT_SUPPORTED"/>
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id="pt" expression="execution(* com.dg11185.ipost.service..*.*(..))"/>
<aop:advisor advice-ref="tx" pointcut-ref="pt"/>
</aop:config> 
<!-- 邮件发送 -->
  <bean id="sender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
<property name="host" value="smtp.exmail.qq.com"></property>
<property name="javaMailProperties">
<props>
<prop key="mail.smtp.auth">true</prop>
<prop key="mail.smtp.timeout">25000</prop>
</props>
</property>
<property name="username" value="${business_mail_username}"></property>
<property name="password" value="${business_mail_pwd}"></property>
</bean> 
<!-- 图片上传 -->
<bean id="stageImage" class="org.springframework.remoting.rmi.RmiProxyFactoryBean">    
        <property name="serviceUrl" value="rmi://${stageUrl}:1200/imageService" />   
        <property name="serviceInterface" value="com.dg11185.ipost.common.StageImage" />
        <property name="lookupStubOnStartup" value="false"/>   
        <property name="refreshStubOnConnectFailure" value="true"/>  
        <property name="cacheStub" value="false"/>   
    </bean>
</beans>

jdbc.properties
username=ipost
password=ipost
driverClassName=oracle.jdbc.driver.OracleDriver
url=jdbc\:oracle\:thin\:@10.196.128.156\:1521\:orcl
initialSize=10
maxIdle=10
minIdle=5
maxActive=20
maxWait=10000
timeBetweenEvictionRunsMillis=180000
minEvictableIdleTimeMillis=180000


 
 
 

                
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值