|  | @ -11,14 +11,20 @@ import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfigurat
 | 
	
		
			
				|  |  | import org.springframework.boot.builder.SpringApplicationBuilder;
 | 
	
		
			
				|  |  | import org.springframework.boot.web.support.SpringBootServletInitializer;
 | 
	
		
			
				|  |  | import org.springframework.data.mongodb.gridfs.GridFsOperations;
 | 
	
		
			
				|  |  | import org.springframework.scheduling.annotation.EnableAsync;
 | 
	
		
			
				|  |  | import org.springframework.scheduling.annotation.EnableScheduling;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import java.util.concurrent.ExecutorService;
 | 
	
		
			
				|  |  | import java.util.concurrent.Executors;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | @EnableScheduling
 | 
	
		
			
				|  |  | @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class})
 | 
	
		
			
				|  |  | @EnableAsync
 | 
	
		
			
				|  |  | public class HosBrokerApplication extends SpringBootServletInitializer implements CommandLineRunner {
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private GridFsOperations operations;
 | 
	
		
			
				|  |  |     private CamelStartBoot camelStartBoot;
 | 
	
		
			
				|  |  |     private ExecutorService executorService = Executors.newSingleThreadExecutor();
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public static void main(String[] args) {
 | 
	
		
			
				|  |  |         SpringApplication app = new SpringApplication(HosBrokerApplication.class);
 | 
	
	
		
			
				|  | @ -28,12 +34,16 @@ public class HosBrokerApplication extends SpringBootServletInitializer implement
 | 
	
		
			
				|  |  |     @Override
 | 
	
		
			
				|  |  |     public void run(String... strings) throws Exception {
 | 
	
		
			
				|  |  |         GridFSUtil.gridFsOperations = operations;
 | 
	
		
			
				|  |  |         camelStartBoot = new CamelStartBoot();
 | 
	
		
			
				|  |  |         camelStartBoot.start();
 | 
	
		
			
				|  |  |         executorService.execute(() -> {
 | 
	
		
			
				|  |  |             camelStartBoot = new CamelStartBoot();
 | 
	
		
			
				|  |  |             camelStartBoot.start();
 | 
	
		
			
				|  |  |         });
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         Runtime.getRuntime().addShutdownHook(new Thread(() -> {
 | 
	
		
			
				|  |  |             try {
 | 
	
		
			
				|  |  |                 camelStartBoot.shutdown();
 | 
	
		
			
				|  |  |                 executorService.shutdown();
 | 
	
		
			
				|  |  |             } catch (Exception ignored) {
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }));
 |