使用注解@Prepestroy
示例:
@Component
public class ExitCodeApplication {
@PreDestroy
public void destory(){
System.out.println("我被销毁、、、、");
}
}
运行结果图:

使用注解@Prepestroy
示例:
@Component
public class ExitCodeApplication {
@PreDestroy
public void destory(){
System.out.println("我被销毁、、、、");
}
}
运行结果图:
本文标题:spring boot在关闭程序得时候释放资源
本文链接:https://www.haomeiwen.com/subject/jjuflctx.html
网友评论