我要用代码向我喜欢的女孩表白

我要用代码向我喜欢的女孩表白

导入依赖

<dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context-support</artifactId>
        </dependency>

对方法添加注解

@Scheduled(cron = "*/2 * * * * ?") 
public void scheduledMethod() { // 设置为两秒启动一次 }

开启注解支持

@SpringBootApplication
@EnableScheduling
public class Application {

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

}

参考:

https://www.cnblogs.com/stdpain/p/11776892.html

08-21 21:32