springboot接入flowable在项目启动时报nested exception is orgspringframeworkbeansfactoryNoSuchBeanDefinitionException No qualifying bean of type orgspringframeworkcoretaskAsyncListenableTaskExecutor available ex
该错误是因为没有找到符合条件的AsyncListenableTaskExecutor类型的bean。解决方法是在Spring Boot的配置类中配置一个AsyncListenableTaskExecutor类型的bean,并且使用@Qualifier("applicationTaskExecutor")注解来指定该bean的名称。
示例代码如下:
@Configuration
public class AppConfig {
@Bean
@Qualifier("applicationTaskExecutor")
public AsyncListenableTaskExecutor taskExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(10);
executor.setMaxPoolSize(20);
executor.setQueueCapacity(30);
executor.setThreadNamePrefix("MyExecutor-");
executor.initialize();
return executor;
}
}
在上述代码中,我们创建了一个ThreadPoolTaskExecutor类型的bean,并且使用@Qualifier("applicationTaskExecutor")注解来指定该bean的名称为"applicationTaskExecutor"。
然后,将上述配置类添加到Spring Boot项目的启动类中,例如:
@SpringBootApplication
@Import(AppConfig.class)
public class MyApplication {
public static void main(String[] args) {
SpringApplication.run(MyApplication.class, args);
}
}
这样就解决了该错误。请根据实际情况修改配置类中的线程池参数
原文地址: http://www.cveoy.top/t/topic/iJIB 著作权归作者所有。请勿转载和采集!