如題,在項目啟動后,自動的 同時運行 方法1,方法2,,這樣子,請問這樣該怎么做?現在有一個解決方案:背景:我的項目是一個定時任務的項目(springboot),比如說,我在整點的時候執行方法1,方法2,方法3,方法4 (當然在方法上我都用@schedual注解了)現在我在這幾個方法上,再用@Async注解,在使用MyApplicationRunner調用這幾個方法。public void run(ApplicationArguments var1) throws Exception{ monitorIaasService.addMonitorIaasDataSummary(); cmpMonitorOpeService.add(); monitorIaasUseRateService.addIaasUseRate(); monitorScheduleService.addBusinessViewSummaryData();}請問這樣能達到,我在啟動項目時,自動同時運行某些方法的目的嗎?
springboot啟動時如何同時運行多個方法
慕絲7291255
2018-08-03 13:05:41