SpringBoot 主动停止关闭项目
SpringBoot启动方法
@SpringBootApplication
public class DemoApplication {
public static ConfigurableApplicationContext context;
public static void main(String[] args) {
context = SpringApplication.run(DemoApplication.class, args);
}
}
只要调用close() 方法就会主动关闭
public void ending(){
DemoApplication.context.close();
}