본문 바로가기
Developer/Spring & eGovFrame

[eGovFrame] java스케줄러 제일 쉽게 만들기

by 순수한소년 2021. 8. 5.
728x90
반응형

C:\test\eGovFrameDev-3.8.0-64bit\workspace\test\src\main\resources\egovframework\spring\com\context-scheduler.xml

1
2
3
4
5
6
7
8
9
10
11
12
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:task="http://www.springframework.org/schema/task"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
        http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.0.xsd ">
 
    <task:scheduler id="scheduler" pool-size="1"/>
    <task:scheduled-tasks scheduler="scheduler">
        <task:scheduled ref="schedulerService" method="setExtApiCheck" cron="0 40 15 * * ?" /><!-- 매 10초마다 Scheduler 작동 : 초 분 시간 일(Day of Month) 월 요일(Day of Week, 1-7 : SUN-SAT) 년도(생략가능) -->
    </task:scheduled-tasks>
</beans>
cs


C:\test\eGovFrameDev-3.8.0-64bit\workspace\test\src\main\java\test\cmm\service\SchedulerService.java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
package test.cmm.service;
 
import org.springframework.stereotype.Service;
 
@Service("schedulerService")
public class SchedulerService {
 
    
    public void setExtApiCheck() {
        System.out.println("호출확인");
    }
    
}
 
cs

 

 

 

728x90
반응형