+
95
-

spring boot如何开启定时器?

spring boot如何开启定时器?

网友回复

+
15
-

1、现在application类中增加注解@EnableScheduling开启定时器

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;

@SpringBootApplication
@EnableScheduling
public class DemoApplication {

	public static void main(String[] args) {
		SpringApplication...

点击查看剩余70%

我知道答案,我要回答