Application.java
1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package vion;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import vion.controller.UserController;
import java.util.concurrent.CountDownLatch;
@SpringBootApplication
@EnableScheduling
public class Application implements CommandLineRunner {
public static void main(String[] args) {
try {
SpringApplication.run(Application.class, args);
new CountDownLatch(1).await();
} catch (Exception e) {
e.printStackTrace();
}
}
@Autowired
private UserController userController;
private final static Logger logger = LoggerFactory.getLogger(Application.class);
//@Scheduled(fixedDelay=1000*60*10,initialDelay=1000)
@Scheduled(cron="${third.run.cron:0 0 2 * * ?}")
public void startJob(){
try {
logger.info("启动");
//定时获取钉钉用户列表
userController.getDingUserList();
//USERNAME_MAP
logger.info("启动完成");
} catch (Exception e) {
e.printStackTrace();
// System.exit(-1);
}
}
@Override
public void run(String... args) throws Exception {
}
}