@Override
    public Injector build() throws InstantiationException {

        // Load settings
        final File configFile = configFileLocation.toFile();
        final Properties properties = loadProperties(INTERNAL_LOGGER, configFile);
        overriddenParams.forEach(properties::setProperty);

        final Set<Class<?>> allInjectableTypes = unmodifiableSet(
            injectables.values().stream()
                .flatMap(List::stream)
                .map(Injectable::get)
                .collect(toSet())
        );

        final Set<Injectable<?>> injectablesSet = unmodifiableSet(
            injectables.values().stream()
                .flatMap(List::stream)
                .collect(toCollection((Supplier<Set<Injectable<?>>>) LinkedHashSet::new))
        );

        final DependencyGraph graph = DependencyGraph.create(injectablesSet.stream().map(Injectable::get), this::proxyFor);

        // Create a pre-configured map so that the instance order can
        // be retained regardless of actual instantiation order, #788
        final Map<Class<?>, Object> instanceMap = injectablesSet.stream()
            .map(Injectable::get)
            .collect(toMap(
                Function.identity(),
                i -> UNINSTANTIATED,
                (a, b) -> a,
                LinkedHashMap::new
            ));

        INTERNAL_LOGGER.debug(String.format("Creating %d injectable instances.", injectablesSet.size()));

        INTERNAL_LOGGER.debug(HORIZONTAL_LINE);

        // Create an instance of every injectable type
        final Set<Injectable<?>> injectablesLeft = new LinkedHashSet<>(injectablesSet);
        while (!injectablesLeft.isEmpty()) {
            tryToCreateInstances(properties, allInjectableTypes, instanceMap, injectablesLeft);
        }

        final LinkedList<Object> instances = instancesSoFarInReversedOrder(instanceMap);

        instanceMap.clear(); // We are done with the map...

        // Build the Injector
        final Injector injector = new InjectorImpl(
            injectablesSet,
            unmodifiableList(instances),
            properties,
            classLoader,
            graph,
            this
        );
        
        // Create ClassMapper
        final ClassMapper classMapper = new ClassMapper() {
            @Override
            public <T> T apply(Class<T> type) {
                return findIn(
                    type, 
                    injector, 
                    instances,
                    true // Required = true
                );
            }

            @Override
            public <T> T applyOrNull(Class<T> type) {
                return findIn(
                    type,
                    injector,
                    instances,
                    false
                );
            }
        };

        // Make sure annotations are used correctly
        instances.forEach(this::assertAnnotationsCorrect);

        // Set the auto-injected fields
        instances.forEach(instance -> setAutoInjectedFields(instance, instances, injector));
        
        // Build explicit executions and add them to the graph
        executions.stream()
            .map(builder -> builder.build(graph))
            .forEachOrdered(execution -> {
                final DependencyNode node = graph.get(execution.getType());
                node.getExecutions().add(execution);
            });

        final AtomicBoolean hasAnythingChanged = new AtomicBoolean();
        final AtomicInteger nextState = new AtomicInteger(0);

        // Go through every state up and including STARTED.
        while (nextState.get() <= State.STARTED.ordinal()) {
            handleNextState(graph, instances, injector, classMapper, hasAnythingChanged, nextState);
        }

        INTERNAL_LOGGER.debug(HORIZONTAL_LINE);
        INTERNAL_LOGGER.debug(
            "| %-79s |",
            "All " + instances.size() + " components have been configured!"
        );
        INTERNAL_LOGGER.debug(HORIZONTAL_LINE);

        return injector;
    }
Default implementation of the {@link InjectorBuilder}-interface.

@author Emil Forslund
@since  1.2.0
common-parent/injector/src/main/java/com/speedment/common/injector/internal/InjectorBuilderImpl.java