We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
由于邮件的发送是一个阻塞操作,因此我将之放到子线程中完成,因此我需要在SpringBoot中配置一个线程池,如下:
@Bean public ExecutorService executorService() { return Executors.newCachedThreadPool(); }
在配置类中提供上面这个bean即可,然后在需要用的地方将之注入即可:
@Autowired ExecutorService executorService;
然后使用:
executorService.execute(new EmailRunnable(employee));