I have a problem with the Google Guice framework.
I'm trying to create a simple application that injects a list of objects. Unfortunately, when trying to run an application, I get the following error.
No implementation for java.util.List was bound. while locating java.util.List for field at Operator.carShops(Operator.java:17) while locating Operator ()
Here is the program code:
public class Main {
public static void main(String[] args) {
Injector injector = Guice.createInjector();
Operator operator = injector.getInstance(Operator.class);
operator.prepareData();
}}
public class Operator implements IOperator {
@Inject
private List<CarShop> carShops;
public List<CarShop> getCarShops() {
return carShops; <--- Place of error occurrence
}
public void setCarShop(List<CarShop> carShops) {
this.carShops = carShops;
}
public void prepareData() {
for(CarShop carShop:carShops)
for(int i=0;i<10;i++) {
Car car = new Car();
car.setPrice(1000);
carShop.addCar(car);
}
}}
Please help