I have the following Spring component:
@Component(LogicQualifiedBeanNames.PRODUCT_EVENTS_FLOW_PROCESSOR)
public class ProductEventsFlowProcessor extends AbstractFlowProcessor {
private List<ProductEventDetector> productEventDetectors;
private BesRequestFactory besRequestFactory;
private BesAccessor besAccessor;
@Autowired
public ProductEventsFlowProcessor(ItemsClassifier<WriteProductItem> itemsClassifier,
@Qualifier(LogicQualifiedBeanNames.PRODUCT_EVENTS_DETECTORS) List<ProductEventDetector> productEventDetectors,
BesRequestFactory requestFactory, BesAccessor besAccessor) {
super(itemsClassifier);
this.productEventDetectors = productEventDetectors;
this.besRequestFactory = requestFactory;
this.besAccessor = besAccessor;
}
And the following configuration class:
@Configuration
public class FlowConfiguration {
private ProductEventDetector deleteProductEventDetector = new DeleteProductEventDetector();
@Bean(name = LogicQualifiedBeanNames.PRODUCT_EVENTS_DETECTORS)
public List<ProductEventDetector> getProductEventDetectors() {
List<ProductEventDetector> productEventDetectors = Lists.newArrayList(deleteProductEventDetector);
return productEventDetectors;
}
}
And the following context configuration file:
<beans:beans>
<import resource="classpath:core-module-context.xml" />
<context:component-scan base-package="com.stackoverflow.logic" />
<aop:aspectj-autoproxy />
</beans:beans>
When I test my application, I get the following message:
org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.stackoverflow.logic.events.ProductEventDetector] found for dependency [collection of com.stackoverflow.logic.events.ProductEventDetector]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Qualifier(value=productEventDetectors)}
I already tried to use DependsOn
annotation, but that doesn't help.