首先編寫任務類,該類繼承quartzjobbean父類,並在其實現方法內編寫job任務
配置spring的xml檔案,配置觸發器,以及排程器的bean
spring框架整合quartz之後,可以不編寫job類,直接將其方法注入到乙個bean中,並在其中指定方法,引數等內容"jobdetail"
class
="org.springframework.scheduling.quartz.jobdetailbean"
>
name
="jobclass"
value
="cn.job.myjob"
>
property
>
bean
>
"******triger"
class
="org.springframework.scheduling.quartz.******triggerbean"
>
name
="jobdetail"
ref="jobdetail"
>
property
>
name
="repeatinterval"
value
="3000"
>
property
>
name
="startdelay"
value
="1000"
>
property
>
bean
>
class
="org.springframework.scheduling.quartz.schedule***ctorybean"
>
name
="triggers"
>
>
bean
="******triger"
/>
array
>
property
>
bean
>
"userser"
class
="cn.service.impl.userserimpl"
>
bean
>
"job"
class
="org.springframework.scheduling.quartz.methodinvokingjobdetailfactorybean"
>
name
="targetobject"
ref="userser"
>
property
>
name
="targetmethod"
value
="adduser"
>
property
>
name
="arguments"
>
>
>
namevalue
>
>
pawvalue
>
array
>
property
>
bean
>
"crontriger"
class
="org.springframework.scheduling.quartz.crontriggerbean"
>
name
="jobdetail"
ref="job"
>
property
>
name
="cronexpression"
value
="0,10,20,30 * * * * ?"
>
property
>
bean
>
class
="org.springframework.scheduling.quartz.schedule***ctorybean"
>
name
="triggers"
>
>
bean
="crontriger"
/>
array
>
property
>
bean
>
Spring整合MyBatis框架
public class student select addstudent parametertype org.yao.entity.student insert into student stunum,stuname,stuage values insert 4 之前使用mybatis,通過co...
spring 整合其他框架配置
1.spring自身 1 以上會自動掃瞄類中的註解,如果不加入這一句,則類中的註解不會生效 2 載入.properties檔案 3 這個會引入springaop的功能,可以配置切面.子標籤有 和完整例子 與網際網路 4 spring的其他配置,將物件的例項化交給容器2.整合spring mvc 必須...
spring框架,整合連線池,整合junit測試
讓spring知道外部的資料庫連線資訊的配置檔案 jdbc.properties 讓spring能夠載入jdbc.properties檔案 spring提供了乙個標籤 可以載入外部的properties檔案內容 導context的命名空間和約束 才會有提示 1.在 spring framework ...