2016-08-16 81 views
2

我有以下错误,同时使用弹簧启动运行的Activiti和网络插口一起:春天开机抽象自动配置问题

Parameter 0 of method springAsyncExecutor in org.activiti.spring.boot.AbstractProcessEngineAutoConfiguration required a single bean, but 4 were found: 
- clientInboundChannelExecutor: defined by method 'clientInboundChannelExecutor' in class path resource [org/springframework/web/socket/config/annotation/DelegatingWebSocketMessageBrokerConfiguration.class] 
- clientOutboundChannelExecutor: defined by method 'clientOutboundChannelExecutor' in class path resource [org/springframework/web/socket/config/annotation/DelegatingWebSocketMessageBrokerConfiguration.class] 
- brokerChannelExecutor: defined by method 'brokerChannelExecutor' in class path resource [org/springframework/web/socket/config/annotation/DelegatingWebSocketMessageBrokerConfiguration.class] 
- messageBrokerTaskScheduler: defined by method 'messageBrokerTaskScheduler' in class path resource [org/springframework/web/socket/config/annotation/DelegatingWebSocketMessageBrokerConfiguration.class] 


Action: 

Consider marking one of the beans as @Primary, updating the consumer to accept multiple beans, or using @Qualifier to identify the bean that should be consumed 

随着春天的Boot使用抽象的配置,我要重写一些配置?

感谢您的帮助。

回答

2

这可以说是Activiti的自动配置类中的一个错误。它依赖于它们在应用程序上下文中唯一的一个TaskExecutor bean,或者如果有多个bean,则它们中的一个是主要的。

您应该能够通过声明自己TaskExecutor豆并将其标记为@Primary,以解决此问题:

@Configuration 
class SomeConfiguration { 

    @Primary 
    @Bean 
    public TaskExecutor primaryTaskExecutor() { 
     ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); 
     // Customize executor as appropriate 
     return executor; 
    } 

} 
+0

大,通过创建我自己的TaskExecutor作为主,它的工作。所以你是对的,这是Activiti自动配置类中的一个bug。 –