▮ spring-framework의 어플리케이션 설정파일에 아래 설정 추가
<bean id=jobDetailBean class="org.springframework.scheduling.quartz.JobDetailBean">
<property name=jobClass value="net.oopscode.ScheduleJobBean"></property>
</bean>
<bean id=cronTriggerBean class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name=jobDetail ref=jobDetailBean/>
<property name=cronExpression value="0/10 * * * * ?"/>
</bean>
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="cronTriggerBean"/>
</list>
</property>
</bean>
▮ 스케줄링할 클래스 생성
public class ScheduleJobBean extends QuartzJobBean {
@Override
protected void executeInternal(JobExecutionContext arg0) throws JobExecutionException {
System.out.println(System.currentTimeMillis());
}
}
댓글 없음:
댓글 쓰기