首先,有这样一个异步监听方法
然后配置好了异步线程池
package com.fdw.study.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import java.util.concurrent.ThreadPoolExecutor;
@ComponentScan(basePackages = {"com.fdw.study.event", "com.fdw.study.eventListener"})
@Configuration
public class EventConfig {
//自定义线程池
@Bean
public ThreadPoolTaskExecutor asyncThreadPoolExecutor() {
ThreadPoolTaskExecutor t