首页 > 代码库 > spring-quartz.xml
spring-quartz.xml
1 <?xml version="1.0" encoding="UTF-8"?> 2 <beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 3 xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop" 4 xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" 5 xsi:schemaLocation="http://www.springframework.org/schema/beans 6 http://www.springframework.org/schema/beans/spring-beans.xsd 7 http://www.springframework.org/schema/aop 8 http://www.springframework.org/schema/aop/spring-aop.xsd 9 http://www.springframework.org/schema/context10 http://www.springframework.org/schema/context/spring-context.xsd11 http://www.springframework.org/schema/tx12 http://www.springframework.org/schema/tx/spring-tx.xsd">13 14 15 16 <!--配置清空MAP的作业类 -->17 <bean id="testQuartz"18 class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">19 <property name="targetObject">20 <bean class="com.pda.quartz.JobTest" />21 </property>22 <property name="targetMethod" value="test" />23 </bean>24 25 26 <!-- targetObject:指定包含任务执行体的Bean实例。27 targetMethod:指定将指定Bean实例的该方法包装成任务的执行体。 -->28 29 30 <!-- 配置清空MAP的触发方式 -->31 <bean id="testTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">32 <property name="jobDetail" ref="testQuartz" />33 <property name="cronExpression" value="0 */1 * * * ?" />34 </bean>35 36 <!-- 配置调度工厂 -->37 <bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean" lazy-init="false">38 <property name="triggers">39 <list> 40 <!-- 清空MAP调度 -->41 <ref bean="testTrigger"/>42 </list>43 </property>44 </bean> 45 46 47 </beans>
1 package com.pda.quartz; 2 3 4 public class JobTest { 5 6 public void test() { 7 8 System.out.println("hhhh"); 9 10 }11 12 }
spring-quartz.xml
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。