본문 바로가기
Programming/Java

spring boot schedule 사용하기

by Chan_찬 2016. 5. 26.
728x90
반응형




@Component
public class Schedule {
@Autowired CommandService commandService;

Logger logger = LoggerFactory.getLogger(this.getClass());

// @Scheduled(cron = "0/10 * * * * *")
@Scheduled(cron = "0 55 11 * * *")
public void runMemberInfo(){
logger.info("send member and evidence info to fms");
commandService.changeStatusToB("MEM","APPLY");
commandService.changeStatusToB("EVD","APPLY");
}
// @Scheduled(cron = "0 55 16 * * *")
public void runWithdrawInfo(){
logger.info("send withdraw info to fms");
}

}


spring boot 에서 schedule 사용하기 위해서는 application에서 @EnableScheduling 어노테이션을 추가해 줘야한다.

@EnableScheduling


@SpringBootApplication
@EnableScheduling
@EnableSwagger2
public class RestapiApplication {


728x90
728x90
BIG
Buy me a coffeeBuy me a coffee

댓글