Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/silverlight/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Spring引导抽象自动配置问题_Java_Spring_Spring Boot - Fatal编程技术网

Java Spring引导抽象自动配置问题

Java Spring引导抽象自动配置问题,java,spring,spring-boot,Java,Spring,Spring Boot,使用spring boot同时运行activiti和web套接字时,我出现以下错误: Parameter 0 of method springAsyncExecutor in org.activiti.spring.boot.AbstractProcessEngineAutoConfiguration required a single bean, but 4 were found: - clientInboundChannelExecutor: defined by method 'clien

使用spring boot同时运行activiti和web套接字时,我出现以下错误:

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
由于spring boot使用抽象配置,我是否必须覆盖某些配置


感谢您的帮助。

这可能是Activiti自动配置类中的一个bug。这取决于它们在应用程序上下文中只是一个
TaskExecutor
bean,或者,如果有多个bean,则其中一个bean是主bean

您应该能够通过声明自己的
TaskExecutor
bean并将其标记为
@Primary
:

@Configuration
class SomeConfiguration {

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

}

很好,通过创建我自己的TaskExecutor作为主要任务执行器,它成功了。所以你是对的,这是Activiti的自动配置类中的一个bug。