import java.util.ServiceLoader;

class DependencyInjectionServiceLoaderMain {
    public static void main(String[] args) {
        System.out.println("Wczytywanie usługi wzorca Wstrzykiwanie zależności: pojazd i silnik");
        ServiceLoader<Engine> engineService = ServiceLoader.load(Engine.class);
        Engine engine = engineService.findFirst().orElseThrow();
        Vehicle vehicle = new SportVehicle(engine);
        vehicle.move();
    }    
}
