<?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:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/task
http://www.springframework.org/schema/task/spring-task-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd">
<context:component-scan base-package="com.pingan.haofang.*">
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath*:jdbc_mysql_db.properties</value>
<!-- <value>classpath*:const.properties</value> -->
</list>
</property>
<property name="ignoreUnresolvablePlaceholders" value="true"/>
</bean>
<bean class="com.pingan.haofang.util.WebAppContextUtil"/>
<import resource="classpath*:spring-database_stats.xml"/>
<import resource="classpath*:spring-database_common.xml"/>
<import resource="classpath*:spring-database_loupan.xml"/>
<!-- 计划任务 计算版块平均价格 start-->
<!-- 要调用的工作类 -->
<bean id="refreshRedisTask" class="com.pingan.haofang.service.impl.RefreshRedisServiceImpl"></bean>
<!-- 定义调用对象和调用对象的方法 -->
<bean id="jobtask" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<!-- 调用的类 -->
<property name="targetObject">
<ref bean="refreshRedisTask"/>
</property>
<!-- 调用类中的方法 -->
<property name="targetMethod">
<value>run</value>
</property>
</bean>
<!-- 定义触发时间 -->
<bean id="doTime" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail">
<ref bean="jobtask"/>
</property>
<!-- cron表达式 -->
<property name="cronExpression">
<value>0 30 23 * * ?</value>
<!--每个月最后一天0点开始执行
<value>0 0 0 L * ?</value>
-->
</property>
</bean>
<!-- 计划任务 计算版块平均价格 end-->
<!-- 总管理类 如果将lazy-init='true'那么容器启动就会执行调度程序, false则不会 -->
<bean id="startQuertz" lazy-init="false" autowire="no" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="doTime"/>
</list>
</property>
</bean>
<!-- 定时器注解使用 -->
<task:annotation-driven/>
</beans>
spring-applicationContext.xml
猜你喜欢
转载自junjin4838.iteye.com/blog/2270659
今日推荐
周排行