Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring dependency injection: Inject all instances of interface

How, if possible can I configure a Spring bean with all a collection of other Spring beans that implements a specific interface?

Example: I want to wire the CarFactory bean with a list of beans implementing the CarManufacturer interface.

like image 521
Kimble Avatar asked Oct 11 '11 11:10

Kimble


Video Answer


1 Answers

@Inject
private List<CarManufacturer> manufacturers;
like image 170
Bozho Avatar answered Oct 24 '22 10:10

Bozho