[spring] Scheduling

@SpringBootApplication
@EnableScheduling
public class QuantApplication {

	public static void main(String[] args) {
		SpringApplication.run(QuantApplication.class, args);
	}
}
// 1. QuantDataController.java, CompanyDetailController.java 
@Scheduled(cron = "0 30 0 * 2,5,7,11 *", zone = "Asia/Seoul")
public ResponseEntity<String> bulkUpdate() 
        throws JsonParseException, JsonMappingException, IOException {
    //해당 Logic...
}

// 2. DailyPriceController.java
@Scheduled(cron = "0 30 16 * * 1-5", zone = "Asia/Seoul")
public ResponseEntity<String> bulkUpdate() 
        throws JsonParseException, JsonMappingException, IOException {
    //해당 Logic...
}

출처 :
https://velog.io/@hanbinleejoy/Spring-Boot-Python%EC%9D%84-%EC%9D%B4%EC%9A%A9%ED%95%9C-%EC%9E%90%EB%A3%8C-%EC%88%98%EC%A7%91-%EC%9E%90%EB%8F%99%ED%99%94

좋은 웹페이지 즐겨찾기