c83b5b39
Liu Haoyu
项目创建, 集成spring-se...
|
1
2
|
package com.objecteye;
|
c83b5b39
Liu Haoyu
项目创建, 集成spring-se...
|
3
4
5
6
7
8
9
10
11
12
|
import com.objecteye.websocket.SelectMongoData;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
c83b5b39
Liu Haoyu
项目创建, 集成spring-se...
|
13
14
|
@SpringBootApplication
|
c83b5b39
Liu Haoyu
项目创建, 集成spring-se...
|
15
16
17
18
19
20
21
22
23
24
25
|
@EnableScheduling
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class VehicleApplication {
public static void main(String[] args) {
ConfigurableApplicationContext run = SpringApplication.run(VehicleApplication.class, args);
//存储系统开始运行时间
SelectMongoData selectMongoData = run.getBean(SelectMongoData.class);
selectMongoData.setSystemStartTime();
|
c83b5b39
Liu Haoyu
项目创建, 集成spring-se...
|
26
27
28
29
30
31
32
33
34
35
36
|
}
@Bean
public TaskScheduler taskScheduler() {
ThreadPoolTaskScheduler threadPoolTaskScheduler = new ThreadPoolTaskScheduler();
threadPoolTaskScheduler.setPoolSize(3);
threadPoolTaskScheduler.initialize();
return threadPoolTaskScheduler;
}
}
|