티스토리 뷰

<!-- Quartz Scheduling Setting -->
 <bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
  <property name="triggers">
   <list>
    <ref local="HitsUpdaterCronTrigger"/>
   </list>
  </property>
 </bean>


 <!-- hits init updater -->
 <bean id="HitsUpdaterMethodInvokingJobDetail"
   class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
  <property name="targetObject"><ref bean="BlogSchedulerService"/></property>
  <property name="targetMethod"><value>updateBlogTodayHits</value></property>
  <property name="concurrent"><value>false</value></property>
 </bean>
 
 <bean id="HitsUpdaterCronTrigger"

class="org.springframework.scheduling.quartz.CronTriggerBean">
  <property name="jobDetail">
   <ref bean="HitsUpdaterMethodInvokingJobDetail"/>
  </property>
  <property name="cronExpression">
     <!-- sec min hour dayOfMonth month dayOfWeek -->
   <value>0 0 0 * * ?</value>
  </property>
 </bean>




cronExpression 예제
1 Seconds (0–59)
2 Minutes (0–59)
3 Hours (0–23)
4 Day of month (1–31)
5 Month (1–12 or JAN–DEC)
6 Day of week (1–7 or SUN–SAT)
7 Year (1970–2099)

*는 all, ?는 설정하지 않음

0 0 0 * * ?
매일 오전 12시에 실행

0 0 0 1 * ?
매월 1일 오전 12시에 실행

0 0 0 ? ? 1 ?
매주 일요일 오전 12시에 실행
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/11   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
글 보관함