package org.example.Config;

import jakarta.annotation.PreDestroy;
import org.example.Utils.DynamicJdbcTemplateRegistry;
import org.example.Utils.FileUtil;
import org.example.Utils.JsEngine;
import org.example.Utils.ResourceExecutors;
import org.springframework.stereotype.Component;

@Component
public class ResourceLifecycleManager {
    @PreDestroy
    public void shutdownResources() {
        FileUtil.shutdownExecutor();
        JsEngine.shutdown();
        ResourceExecutors.shutdownAll();
        DynamicJdbcTemplateRegistry.closeAll();
    }
}
