退房的类型
AsyncConfigurer,
AsyncConfigurerSupport和
SchedulingConfigurer。它们是帮助程序类型,您可以使用它们来
@Configuration通过异步/调度配置来增强您的课程。
在所有这些代码以及的javadoc中
@EnabledAsync,您将找到设置异步/计划
@Configuration类所需的所有设置方法。
给出的例子等同于
@Configuration @EnableAsync public class AppConfig implements AsyncConfigurer { @Bean public MyAsyncBean asyncBean() { return new MyAsyncBean(); } @Override public Executor getAsyncExecutor() { ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); executor.setCorePoolSize(7); executor.setMaxPoolSize(42); executor.setQueueCapacity(11); executor.setThreadNamePrefix("MyExecutor-"); executor.initialize(); return executor; } @Override public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() { return new MyAsyncUncaughtExceptionHandler(); } }与
<beans> <task:annotation-driven executor="myExecutor" exception-handler="exceptionHandler"/> <task:executor id="myExecutor" pool-size="7-42" queue-capacity="11"/> <bean id="asyncBean" /> <bean id="exceptionHandler" /> </beans>
SchedulingConfigurer的设置类似
task:scheduler。



