Spring autoinstall BlockingQueue

I'm trying to autoset a parameterized blocking queue:

@Bean(name = "saveProductQueue")
public BlockingQueue<ProductDto> saveProductQueue() {
    return new LinkedBlockingQueue<>();
}

@Autowired
private BlockingQueue<ProductDto> outputQueue;

      

However spring complains:

No qualifying bean of type [ProductDto] found for dependency
[collection of ProductDto]: expected at least 1

      

Has anyone seen anything like this before? I am using spring 4.1.6.RELEASE

+3


source to share


2 answers


BlockingQueue

is a collection and must be injected with @Resource

 @Resource
 private BlockingQueue<ProductDTO> saveProductQueue;

      



@ Works with subtype:

@Autowired
private LinkedBlockingQueue<ProductDTO> saveProductQueue;

      

+5


source


You need to annotate your "outer" (class where saveProductQueue()

) class with@Configuration



0


source







All Articles