package com.objecteye; 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; import org.springframework.transaction.annotation.EnableTransactionManagement; @SpringBootApplication @EnableTransactionManagement @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(); } @Bean public TaskScheduler taskScheduler() { ThreadPoolTaskScheduler threadPoolTaskScheduler = new ThreadPoolTaskScheduler(); threadPoolTaskScheduler.setPoolSize(3); threadPoolTaskScheduler.initialize(); return threadPoolTaskScheduler; } }