我有一个SpringBoot应用程序:
@SpringBootApplication @EnableScheduling @Import({SecurityConfig.class}) public class BlogsApplication implements CommandLineRunner { .. }
我也有这门课,
@Component public class UptadeCurrencyJob1 { @Scheduled(cron = "0 0/10 1 * * ?") public void reportCurrentTime() throws IOException { System.out.println("UptadeCurrencyJob1"); } }
但它从不打电话
@Scheduled(cron = "0 0/10 1 * * ?")
实际上,这是有效的cron表达式,意味着它将在午夜后每隔10分钟发射一次(仅1小时)。我打赌你没有等那么久,你也不是那个意思。