Spring task Scheduler

min·2021년 11월 15일
0

참고
https://jieun0113.tistory.com/115

Scheduler

  • application-context.xml에서 스케줄링되는 테스크를 설정하는 기능.
  • 모든 task들은 트리거가 존재해서 그렇게 시작된다.
<beans profile="??">
		<context:component-scan base-package="??" />
		
		<task:scheduled-tasks scheduler="taskScheduler">
			<task:scheduled ref="example1" method="execute" fixed-delay="1000" />
			<task:scheduled ref="example2" method="execute" cron="0 1 * * * *" />
		</task:scheduled-tasks>
	</beans>
  • 표현
    • fixed-delay : 이전 실행된 task의 종료 시간으로부터 정의된 시간만큼 지난 후 다음 task 실행 (ms)
    • fixed-rate : 이전 실행된 task의 시작 시간으로부터 정의된 시간만큼 지난 후 다음 task 실행 (ms)
    • Cron Expression
      • 초 분 시 일 월 요일

        0 0/5 * * * ? : 5분 간격 매일 실행

profile
발등에 불이 따뜻하다..

0개의 댓글