1
zj
2024-06-13 4680141b47cf95358b7edfb4000564ba0e973612
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package com.yami.trading.init;
 
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextClosedEvent;
import org.springframework.stereotype.Service;
 
/**
 * @author caster
 * @since 2023/11/18
 */
@Service
public class ContextCloseListener implements ApplicationListener<ContextClosedEvent> {
    private Logger logger = LoggerFactory.getLogger(this.getClass());
    
    /**
     * 停止 springboot 时调用了一次
     */
    @Override
    public void onApplicationEvent(ContextClosedEvent event) {
        // 关闭所有的线程池,回收其他资源
 
    }
}