@SuppressWarnings("rawtypes")
    public synchronized void run() throws Exception {
        logger.info("Dependency injection run started...");
        if (initialized) {
            logger.info("Dependency injection already performed. This run will be skipped.");
            return;
        }

        // Find classes annotated with @Component.
        List<Class> components = packageScanner.findAnnotatedClasses("rs.codecentric.meetup.diioc.example", Component.class);

        // For each component...
        for (Class component : components) {
            Class definingClass = classScanner.getDefiningClass(component);
            // ... check if its instance already exists...
            if (!graph.containsKey(definingClass)) {
                // ... and instantiate it, if it doesn't.
                String className = component.getName();
                logger.info("Instantiating class " + className);
                graph.put(definingClass, Class.forName(component.getName()).newInstance());
            }
        }

        // For each object that is created...
        for (Iterator<Class> classIterator = graph.keySet().iterator(); classIterator.hasNext();) {
            Class definingClass = classIterator.next();
            Object object = graph.get(definingClass);

            // ... find dependencies it needs, ...
            for (Field f : classScanner.findAnnotatedFields(object.getClass(), Inject.class)) {
                if (!graph.containsKey(f.getType())) {
                    // ... throw an error if a dependency cannot be satisfied, ...
                    throw new RuntimeException("Dependency cannot be satisfied! No instance of " + f.getType() + " found to satisfy dependency " + f);
                }
                boolean accessModified = false;
                if (!f.isAccessible()) {
                    f.setAccessible(true);
                    accessModified = true;
                }

                // ... or set a value of the dependency.
                Object dependency = graph.get(f.getType());
                logger.info("Injecting " + dependency + " into " + f);
                f.set(object, dependency);

                if (accessModified) {
                    // I am a good citizen.
                    f.setAccessible(false);
                }
            }
        }

        initialized = true;
        logger.info("Dependency injection run finished.");
    }