package com.skr.mdm.config;

import com.skr.mdm.util.MdmThreadPoolUtil;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.event.ApplicationEventMulticaster;
import org.springframework.context.event.SimpleApplicationEventMulticaster;

/**
 * @author nfq
 * @date 2023-07-17 09:52:46
 */
@Configuration
public class ApplicationEventAsyncConfig {

    @Bean
    public ApplicationEventMulticaster applicationEventMulticaster() {
        SimpleApplicationEventMulticaster simpleApplicationEventMulticaster = new SimpleApplicationEventMulticaster();
        // 事件监听器使用线程池处理任务
        simpleApplicationEventMulticaster.setTaskExecutor(MdmThreadPoolUtil.getThreadPool());
        return simpleApplicationEventMulticaster;
    }
}
