less than 1 minute read

Spring Scheduling 어노테이션 사용

메인 어플리케이션에 @EnableScheduling 붙여주고

@EnableScheduling
@SpringBootApplication
public class MainApplication extends SpringBootServletInitializer implements ServletContextAware {

}

이런방식으로 사용

@Component
public class ExampleScheduler {
	@Scheduled(cron = "0 0 11 * * *")
	public void scheduleFixedRateTask() {
		System.out.println( "Fixed rate task - " + System.currentTimeMillis() / 1000);
	}
}

Categories:

Updated: