1.简单描述 在SpringBoot2.0.9之前需要手动自定义线程池(如下2.1), 然后指定线程池的名称 SpringBoot2.0.9以及之前的版本,使用的线程池默认是SimpleAsyncTaskExcutor, , 之后的版本使用的是ThreadpoolTaskExecutor 并且不需要手动的创建当前线程池(但往往我们还是会手动指定,具体原因看源码就可以自有判断⚜️ ). SpringBoot会自动的扫描两个文件下的配置信息: 所以如果我们写的配置类想让SpringBoot自动扫描到就可以放到两个中的任意一个 我们项目中就是这样使用的:在 spring.factories文件中指定一些配置类相对路径,这样配置类中的指定的Bean就可以放入到IOC容器中了 SpringBoot在org.springframework.boot.autoconfigure.AutoConfiguration.imports118行配置了TaskExecutionAutoConfiguration的位置,这样SpringBoot就可以扫描到当前配置类 2.
Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile
Get in touch with this.keepAlive
Contact this.keepAlive, search articles and posts on X, monitor coverage, and track replies from one place.
Learn more about Muck Rack