Where The Streets Have No Name

annotation based scheduler 본문

Developement/Java

annotation based scheduler

highheat 2011. 11. 4. 10:31
<?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.xsd
                        http://www.springframework.org/schema/task
                        http://www.springframework.org/schema/task/spring-task-3.0.xsd">

	<task:scheduler id="taskScheduler" />
	<task:executor id="taskExecutor" pool-size="1" />
	<task:annotation-driven executor="taskExecutor" scheduler="taskScheduler" />
	
</beans>
package egovframework.rte.test.web;

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

@Service
public class Scheduler {

	@Scheduled(cron="*/10 * * * * *")
	public void job(){
		System.out.println("@@@@@@@@@@@@@@@@@ - scheduler job");
	}
}