解道jdon.com

解道jdon.com -

SpringBoot如何​​​​​​​在关闭容器之前实现自己逻辑?

有时,我们需要在关闭spring容器之前做一些额外的工作,比如关闭资源文件。 这时,你可以实现DisposableBean接口并重写其destroy方法。 @Service public class DService implements InitializingBean, DisposableBean {       @Override     public void destroy() throws Exception {         System.out.println( "DisposableBean destroy" );     }    ..

springboot 容器

相关推荐 去reddit讨论

热榜 Top10

Dify.AI
Dify.AI
观测云
观测云
LigaAI
LigaAI
eolink
eolink

推荐或自荐