class DriverComponentImpl implements DriverComponent {

    // Driver names are cached because getting a Driver
    // is expensive and is called within the get connection loop
    // in the ConnectionPoolComponent,
    // See https://github.com/speedment/speedment/issues/725
    // And yes, we should not put Optionals in Maps but
    // here it was so convenient.  :-)
    private final Map<String, Optional<Driver>> cache;
    private Injector injector;

    public DriverComponentImpl() {
        this.cache = new ConcurrentHashMap<>();
    }

    @ExecuteBefore(STARTED)
    public void setInjector(Injector injector) {
        this.injector = injector;
    }

    @Override
    public Optional<Driver> driver(String driverName) {
        return cache.computeIfAbsent(driverName, this::driverHelper);
    }

    private Optional<Driver> driverHelper(String driverName) {<FILL_FUNCTION_BODY>}
}

        requireNonNull(driverName);
        Driver driver = null;
        try {
            final Class<?> driverClass = Class.forName(
                driverName,
                true,
                injector.classLoader()
            );
            if (Driver.class.isAssignableFrom(driverClass)) {
                driver = (Driver) driverClass.getDeclaredConstructor().newInstance();
            }
        } catch (final ClassNotFoundException ex) {
            try {
                // Some JavaEE servers, notably Tomcat, runs the driver on the
                // standard classloader.  This is the reason we need to check an
                // extra time.
                final Class<?> driverClass = Class.forName(driverName);
                if (Driver.class.isAssignableFrom(driverClass)) {
                    driver = (Driver) driverClass.getDeclaredConstructor().newInstance();
                }
            } catch (final ClassNotFoundException | IllegalAccessException
                | InstantiationException | NoSuchMethodException
                | InvocationTargetException ex2) {
                // Do nothing.
            }
        } catch (IllegalAccessException | InstantiationException
            | NoSuchMethodException | InvocationTargetException ex3) {
            // Do nothing.
        }
        return Optional.ofNullable(driver);
    
<no_super_class>