티스토리 뷰

1. 버전 pom.xml

		<spring.maven.artifact.version>4.3.16.RELEASE</spring.maven.artifact.version>
		<egovframework.rte.version>3.8.0</egovframework.rte.version>

 

2. context-task.xml

<?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:context="http://www.springframework.org/schema/context" 
	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/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
						http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.0.xsd">
	<context:component-scan base-package="egovframework.test.task.component" />
	<task:annotation-driven />
</beans>

 

3. TaskTest.java

package egovframework.test.task.component;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class TestTask {
	@Scheduled(cron="0/30 * * * * *") //매 0초 30초에 실행
	public void test1() throws Exception {
		System.out.println("task run");
	}
}

 

끝.

 
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/05   »
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 31
글 보관함