application.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:tx="http://www.springframework.org/schema/tx" xmlns:jdbc="http://www.springframework.org/schema/jdbc"
    xmlns:task="http://www.springframework.org/schema/task" xmlns:cache="http://www.springframework.org/schema/cache"
    xmlns:p="http://www.springframework.org/schema/p"
    xsi:schemaLocation="http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd
        http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd
        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
	<bean id="propertyConfigurer"
		class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
		<property name="locations">
			<list>
				<value>file:${user.dir}/conf/log4j.properties</value>
				<value>file:${user.dir}/conf/mysql.properties</value>
				<value>file:${user.dir}/conf/memcache.properties</value>
				<value>file:${user.dir}/conf/redis.properties</value>
			</list>
		</property>
	</bean>	
	<context:component-scan base-package="com.xyh.oversea.offer.dao" />	
	<!-- jdbc dataSource-->
	<bean id="db" class="org.logicalcobwebs.proxool.ProxoolDataSource">
		<property name="driver">
			<value>${mysql.driver}</value>
		</property>
		<property name="driverUrl">
			<value>${mysql.adsurl}</value>
		</property>
		<property name="user" value="${mysql.username}" />
		<property name="password" value="${mysql.password}" />
		<property name="alias" value="Ads" />
		<property name="maximumActiveTime" value="${mysql.maxActiveTime}" />
		<property name="maximumConnectionCount" value="${mysql.maxConnCount}" />
		<property name="minimumConnectionCount" value="${mysql.minConnCount}" />
		<property name="simultaneousBuildThrottle" value="${mysql.buildThrottle}" />
		<property name="houseKeepingTestSql" value="${mysql.keepTestSql}" />
	</bean>
	
	<!-- memcache -->
	<bean name="memcachedClientBuilder" class="net.rubyeye.xmemcached.XMemcachedClientBuilder">
		<constructor-arg>
			<list>
				<bean class="java.net.InetSocketAddress">
					<constructor-arg>
						<value>${xmemcache.host}</value>
					</constructor-arg>
					<constructor-arg>
						<value>${xmemcache.port}</value>
					</constructor-arg>
				</bean>
			</list>
		</constructor-arg>
		<property name="connectionPoolSize">
			<value>${xmemcache.connection.pool}</value>
		</property>
		<property name="commandFactory">
			<bean class="net.rubyeye.xmemcached.command.BinaryCommandFactory"></bean>
		</property>
		<property name="sessionLocator">
			<bean class="net.rubyeye.xmemcached.impl.KetamaMemcachedSessionLocator"></bean>
		</property>
		<property name="transcoder">
			<bean class="net.rubyeye.xmemcached.transcoders.SerializingTranscoder" />
		</property>
	</bean>
	<bean name="memcachedClient" factory-bean="memcachedClientBuilder"
		factory-method="build" destroy-method="shutdown" />
	<bean id="redisPoolConfig" class="redis.clients.jedis.JedisPoolConfig">
		<property name="maxTotal" value="${redis.maxTotal}" />
		<property name="maxIdle" value="${redis.maxIdle}" />
		<property name="maxWaitMillis" value="${redis.maxWaitMillis}"/>
		<property name="timeBetweenEvictionRunsMillis" value="${redis.timeBetweenEvictionRunsMillis}" />
		<property name="minEvictableIdleTimeMillis" value="${redis.minEvictableIdleTimeMillis}" />
		<property name="testOnBorrow" value="${redis.testOnBorrow}" />
	</bean>	
	<bean id="redisConfig" class="com.xyh.oversea.offer.cache.redis.RedisConfig">
		<property name="host" value="${redis.host}" />
		<property name="port" value="${redis.port}" />
		<property name="timeOut" value="${redis.timeOut}"/>
		<property name="jedisPoolConfig" ref="redisPoolConfig" />
	</bean>	
	<bean id="pullOfferJob" class="com.xyh.oversea.offer.jobs.PullOfferJob">
		<property name="version" value="1"/>
		<property name="os" value="cps"/>
	</bean>
	<bean id="updateOffers"
		class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
		<property name="targetObject">
			<ref bean="pullOfferJob" />
		</property>
		<property name="targetMethod">
			<value>updateOffers</value>
		</property>
	</bean>
	<bean id="updatePostCallBack"
		class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
		<property name="targetObject">
			<ref bean="pullOfferJob" />
		</property>
		<property name="targetMethod">
			<value>updatePostCallBack</value>
		</property>
	</bean>
	<bean id="pullOffer"
		class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
		<property name="jobDetail">
			<ref bean="updateOffers" />
		</property>
		<property name="cronExpression">
			<value>30 0/11 * * * ?</value>
		</property>
	</bean> 
	<bean id="updateClick"
		class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
		<property name="jobDetail">
			<ref bean="updatePostCallBack" />
		</property>
		<property name="cronExpression">
			<value>0 27 20 * * ?</value>
		</property>
	</bean>	
	<bean id="startQuertz" lazy-init="false" autowire="no"
		class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
		<property name="triggers">
			<list>
			    <ref bean="pullOffer" />
			   <!--  <ref bean="updateClick" /> -->
			</list>
		</property>
	</bean>
</beans>

  

posted on 2016-08-08 15:56  让编程成为一种习惯  阅读(166)  评论(0编辑  收藏  举报