之前这么用过
public void restart(){
ExecutorService threadPool = new ThreadPoolExecutor(1,1,0, TimeUnit.SECONDS,new ArrayBlockingQueue<>( 1 ),new ThreadPoolExecutor.DiscardOldestPolicy ());
threadPool.execute (()->{
context.close ();
//do xxxx
}
context =
SpringApplication.run ( Application.class,args );
} );
threadPool.shutdown ();
}