首先我們來寫乙個被排程的類: package com.kay.quartz;
public class quartzjobspring的quartz配置檔案:}
<?我們需要把log4j的配置檔案放入src目錄下,啟動main類就可以了。xml
version
="1.0"
encoding
="utf-8"
?>
>
<
beans
>
<
bean
id=
"quartzjob"
class
="com.kay.quartz.quartzjob">
bean
>
<
bean
id=
"jobtask"
class
="org.springframework.scheduling.quartz.methodinvokingjobdetailfactorybean"
>
<
property
name
="targetobject"
>
<
ref
bean
="quartzjob"
/>
property
>
<
property
name
="targetmethod"
>
<
value
>
work
value
>
property
>
bean
>
<
bean
id=
"dotime"
class
="org.springframework.scheduling.quartz.crontriggerbean"
>
<
property
name
="jobdetail"
>
<
ref
bean
="jobtask"
/>
property
>
<
property
name
="cronexpression"
>
<
value
>
10,15,20,25,30,35,40,45,50,55 * * * * ?
value
>
property
>
bean
>
<
bean
id=
"startquertz"
lazy-init
="false"
autowire
="no"
class
="org.springframework.scheduling.quartz.schedule***ctorybean"
>
<
property
name
="triggers"
>
<
list
>
<
ref
bean
="dotime"
/>
list
>
property
>
bean
>
beans
>
測試程式:
package com.kay.quartz;
public class maintest
}
Spring中的Quartz配置
quartz是乙個強大的企業級任務排程框架,spring中繼承並簡化了quartz。下面就看看在spring中怎樣配置quartz。首先我們來寫乙個被排程的類 quartzjob package com.kay.quartz public class quartzjob spring的quartz配...
Spring中Quartz的配置
quartz是乙個強大的企業級任務排程框架,spring中繼承並簡化了quartz,下面就看看在spring中怎樣配置quartz 首先我們來寫乙個被排程的類 public class quartzjob spring的配置檔案 work 10,15,20,25,30,35,40,45,50,55 ...
Spring中Quartz的配置
quartz是乙個強大的企業級任務排程框架,spring中繼承並簡化了quartz,下面就看看在spring中怎樣配置quartz 首先我們來寫乙個被排程的類 package com.kay.quartz public class quartzjob spring的配置檔案 work 10,15,2...