2016-08-16 83 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。 –