关于Spring中的@Async的使用问题
在使用过程中发现在applicationContext.xml中仅配置 <task:annotation-driven/> 就可以使用@Async注解处理异步
第一种配置:
<task:annotation-driven/>
第二种配置:
<task:annotation-driven executor="myExecutor"/>
<task:executor id="myExecutor" pool-size="5-10" queue-capacity="200" keep-alive="180" rejection-policy="ABORT"/>
之前一直使用的是第一种配置,使用spring的默认线程池来处理。但在查询各种@Async的使用方法时,都是使用的第二种配置方式。想请教一下使用第一种有什么弊端,这两种有什么区别
默认的线程池不一定符合你的业务需求