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:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:oscache="http://www.springmodules.org/schema/oscache"
 xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsdhttp://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsdhttp://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd http://www.springframework.org/schema/txhttp://www.springframework.org/schema/tx/spring-tx-2.5.xsd http://www.springmodules.org/schema/oscachehttp://www.springmodules.org/schema/cache/springmodules-oscache.xsd">
 <!-- pushmarketing.txt URL config -->
 <bean id="xInitializing" class="com.lenovo.lps.psb.pushmarketing.common.Initializing"><property name="keyFile" value="YmpweHQudHh0" /></bean>


   <!-- The BeanPostProcessor will automatically inject beans marked with @Autowired-->     
   <bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor"/>

 <!-- JDBC参数配置 -->
 <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" lazy-init="true">
  <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
  <property name="ignoreResourceNotFound" value="true" />
  <property name="locations">
   <list>
    <value>/WEB-INF/pushmarketing.properties</value>
    <value>/WEB-INF/jdbc.properties</value><!--
      <value>${jboss.server.config.url}pushmarketing_web/pushmarketing.properties</value>
      <value>${jboss.server.config.url}pushmarketing_web/jdbc.properties</value> 
   --></list>
  </property>
 </bean>


 <!-- DBCP数据源配置 
 <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
  <property name="driverClassName" value="${jdbc.driverClass}" />
  <property name="url" value="${jdbc.url}" />
  <property name="username" value="${jdbc.username}" />
  <property name="password" value="${jdbc.password}" />
  <property name="initialSize" value="5" />
  <property name="maxActive" value="10" />
  <property name="minIdle" value="10" />
  <property name="maxIdle" value="10" />
 </bean>
 -->
 
 <!-- C3P0数据源配置 -->
 <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
  <property name="driverClass" value="${jdbc.driverClass}" />
  <property name="jdbcUrl" value="${jdbc.url}" />
  <property name="user" value="${jdbc.username}" />
  <property name="password" value="${jdbc.password}" />
  <property name="autoCommitOnClose" value="${jdbc.autoCommitOnClose}" />
  <property name="checkoutTimeout" value="${cpool.checkoutTimeout}" />
  <property name="initialPoolSize" value="${cpool.minPoolSize}" />
  <property name="minPoolSize" value="${cpool.minPoolSize}" />
  <property name="maxPoolSize" value="${cpool.maxPoolSize}" />
  <property name="maxIdleTime" value="${cpool.maxIdleTime}" />
  <property name="acquireIncrement" value="${cpool.acquireIncrement}" />
  <property name="maxIdleTimeExcessConnections" value="${cpool.maxIdleTimeExcessConnections}" />
 </bean>
 
 
 <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
  <!-- 配置Hibernate拦截器,自动填充数据的插入、更新时间 -->
  <property name="entityInterceptor" ref="entityInterceptor" />
  
  
  <property name="dataSource" ref="dataSource" />
  <property name="hibernateProperties">
   <value>
    <!-- 设置数据库方言 -->
    hibernate.dialect=${hibernate.dialect}
    <!-- 设置自动创建|更新|验证数据库表结构 -->
    hibernate.hbm2ddl.auto=update
    <!-- 输出SQL语句到控制台 -->
    hibernate.show_sql=${hibernate.show_sql}
    <!-- 格式化输出到控制台的SQL语句 -->
    hibernate.format_sql=${hibernate.format_sql}
    <!-- 是否开启二级缓存 -->
    hibernate.cache.use_second_level_cache=false
    <!-- 配置二级缓存产品 -->
    hibernate.cache.provider_class=org.hibernate.cache.OSCacheProvider
    <!-- 是否开启查询缓存 -->
    hibernate.cache.use_query_cache=false
    <!-- 数据库批量查询数 -->
    hibernate.jdbc.fetch_size=50
    <!-- 数据库批量更新数 -->
    hibernate.jdbc.batch_size=30
   </value>
  </property>

  <property name="annotatedClasses">
   <list>
       <value>com.lenovo.lps.psb.pushmarketing.entity.TestDevice</value>
    <value>com.lenovo.lps.psb.pushmarketing.entity.Area</value>
    <value>com.lenovo.lps.psb.pushmarketing.entity.LogConfig</value>
    <value>com.lenovo.lps.psb.pushmarketing.entity.Log</value>
    <value>com.lenovo.lps.psb.pushmarketing.entity.Admin</value>
    <value>com.lenovo.lps.psb.pushmarketing.entity.Role</value>
    <value>com.lenovo.lps.psb.pushmarketing.entity.Resource</value>
    <value>com.lenovo.lps.psb.pushmarketing.entity.DeviceInfoVO</value>
    <value>com.lenovo.lps.psb.pushmarketing.entity.DeviceDimenInfo</value>
    <value>com.lenovo.lps.psb.pushmarketing.entity.PushTaskInfo</value>
    <value>com.lenovo.lps.psb.pushmarketing.entity.PushTaskFeedback</value>
   </list>
  </property>
 </bean>

 <!-- 缓存配置 -->
 <oscache:config configLocation="classpath:oscache.properties" id="cacheProvider" />
 <oscache:annotations providerId="cacheProvider">
  <oscache:caching id="caching" cronExpression="0 1 * * *" refreshPeriod="86400" />
  <oscache:flushing id="flushing" />
 </oscache:annotations>
 
 <bean id="cacheManager" class="org.springmodules.cache.provider.oscache.OsCacheManagerFactoryBean">
        <property name="configLocation" value="classpath:oscache.properties" />
    </bean>
    
 <!-- 设置需要进行Spring注解扫描的类包 -->
 <context:component-scan base-package="com.lenovo.lps.psb.pushmarketing." />

 <!-- 使用AspectJ方式配置AOP -->
 <aop:aspectj-autoproxy proxy-target-class="true" />
 <aop:config proxy-target-class="true" />

 <!-- 使用注解方式定义事务 -->
 <tx:annotation-driven proxy-target-class="true" transaction-manager="transactionManager" />

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

 <!-- 配置事务传播特性 -->
 <tx:advice id="transactionAdvice" transaction-manager="transactionManager">
  <tx:attributes>
   <tx:method name="save*" propagation="REQUIRED" />
   <tx:method name="delete*" propagation="REQUIRED" />
   <tx:method name="update*" propagation="REQUIRED" />
   <tx:method name="get*" read-only="true" />
   <tx:method name="load*" read-only="true" />
   <tx:method name="find*" read-only="true" />
   <tx:method name="*" read-only="true" />
  </tx:attributes>
 </tx:advice>

 <!-- 配置哪些类的哪些方法参与事务 -->
 <aop:config>
  <aop:advisor pointcut="execution(* com.lenovo.lps.psb.pushmarketing.service..*.*(..))" advice-ref="transactionAdvice" />
 </aop:config>

 <!-- 配置freemarkerManager -->
 <bean id="freemarkerManager" class="org.apache.struts2.views.freemarker.FreemarkerManager" />

 <!-- 配置JCaptcha验证码功能 -->
 
 <bean id="captchaService" class="com.octo.captcha.service.image.DefaultManageableImageCaptchaService">
  <property name="captchaEngine">
   <bean class="com.lenovo.lps.psb.pushmarketing.common.JCaptchaEngine" />
  </property>
  <!-- 验证码过期时间 -->
  <property name="minGuarantedStorageDelayInSeconds" value="600" />
 </bean>
 
 
  
 <!-- 重建索引配置
  
 <bean id="indexBuilder" class="com.lenovo.lps.psb.pushmarketing.common.CompassIndexBuilder">
  <property name="compassGps" ref="compassGps" />
  <property name="lazyTime" value="30" />
 </bean>
  -->
 
 <!-- SMTP邮件服务配置 -->
 <bean id="javaMailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
  <property name="javaMailProperties">
   <props>
    <prop key="mail.smtp.auth">true</prop>
    <prop key="mail.smtp.timeout">25000</prop>
    <!-- SSL连接配置 -->
    <!--
    <prop key="mail.smtp.starttls.enable">true</prop>  
    <prop key="mail.smtp.socketFactory.class">javax.net.ssl.SSLSocketFactory</prop>
    -->
   </props>
  </property>
 </bean>
 
 <!-- SMTP邮件异步发送 -->
 <bean id="taskExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
  <!-- 核心线程数 -->
  <property name="corePoolSize" value="10" />
  <!-- 最大线程数 -->
  <property name="maxPoolSize" value="50" />
  <!-- 最大队列数 -->
  <property name="queueCapacity" value="10000" />
  <!-- 线程池维护线程所允许的空闲时间 -->
  <property name="keepAliveSeconds" value="60" />
 </bean>

 <!--mq配置定时器任务的调度器 
 
 <bean id="dealAuctionTimerFactory" class="org.springframework.scheduling.concurrent.ScheduledExecutorFactoryBean">  
  <property name="scheduledExecutorTasks"> 
  <list>  
   <ref local="dealAuctionTaskInfo" />  
  </list>  
  </property>  
 </bean>

 <bean id="dealAuctionTaskInfo" class="org.springframework.scheduling.concurrent.ScheduledExecutorTask">  
  <property name="delay">  
   <value>${Auction.TaskDelay}</value>
  </property>  
   <property name="period">
  <value>${Auction.TaskPeriod}</value>
  </property>  
  <property name="runnable">  
   <ref local="dealAuctionWorker" />  
  </property>
 </bean> 
 
 <bean id="dealAuctionWorker" class="com.lenovo.lps.psb.pushmarketing.action.shop.DealAuctionWorkerAction" >
    

 </bean>
 -->


 
 <!-- PB缓存  -->
 <bean id="deviceStateCache" class="com.lenovo.lps.psb.pb.cache.DeviceStateCache">
  <property name="baseCache" ref="psbMemCachedClient" />
  <property name="psbCachePreFix" value="PSB." />
  <property name="devStateCachePre" value="devInfo_" />
  <property name="ttl" value="86400000" />
 </bean>
 

 <bean id="pushCntCache" class="com.lenovo.lps.psb.pb.cache.PushCntCache">
  <property name="baseCache" ref="psbMemCachedClient" />
  <property name="psbCachePreFix" value="PSB." />
  <property name="pushcntCachePre" value="pushcnt_sidmsgs" />
 </bean>

 <bean id="psbMemCachedClient" class="com.lenovo.lps.psb.pb.cache.PSBMemCachedClient">
     <constructor-arg>
   <value>psb</value>
  </constructor-arg>
 </bean>
 
 <bean id="memcache" class="com.danga.MemCached.SockIOPool"
  factory-method="getInstance" init-method="initialize" destroy-method="shutDown">
  <constructor-arg>
   <value>psb</value>
  </constructor-arg>
  <property name="servers">
   <list>
    <value>${lps.psb.pb.memcached.server1}</value>
    <value>${lps.psb.pb.memcached.server2}</value>
   </list>
  </property>
  <property name="initConn">
   <value>4</value>
  </property>
  <property name="minConn">
   <value>8</value>
  </property>
  <property name="maxConn">
   <value>20</value>
  </property>
  <property name="maintSleep">
   <value>20</value>
  </property>
  <property name="nagle">
   <value>false</value>
  </property>
 </bean>
 
  
 <bean id="jCaptchaFilter" class="com.lenovo.lps.psb.pushmarketing.common.JCaptchaFilter">
  <property name="captchaService" ref="captchaService" />
 </bean>
 
 <bean id="adminLoginJCaptchaFilter" class="com.lenovo.lps.psb.pushmarketing.common.AdminLoginJCaptchaFilter">
  <property name="captchaService" ref="captchaService" />
 </bean>
 
 <!-- 
 <bean id="logDao" class="com.lenovo.lps.psb.pushmarketing.dao.impl.LogDaoImpl">
 </bean>
 
 <bean id="logService" class="com.lenovo.lps.psb.pushmarketing.service.impl.LogServiceImpl">
 </bean>
 
 <bean id="adminService" class="com.lenovo.lps.psb.pushmarketing.service.impl.AdminServiceImpl">
 </bean>
 
 <bean id="logConfigService" class="com.lenovo.lps.psb.pushmarketing.service.impl.LogConfigServiceImpl">
 </bean> 
 
 <bean id="logConfigDao" class="com.lenovo.lps.psb.pushmarketing.dao.impl.LogConfigDaoImpl">
 </bean>
 
  -->
  
  <!--  
 <bean id="systemConfigUtil" class="com.lenovo.lps.psb.pushmarketing.util.SystemConfigUtil" scope="singleton">
  
  <property name="classPath" value="${lps.psb.pm.classPath}" />
 </bean>
 -->
</beans>

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326971019&siteId=291194637
Recommended