public static URL getResource(String resource, boolean classesFirst,
                                  Class<?>... classes) {
        URL url;
        if (classesFirst) {
            url = getResourceViaClasses(resource, classes);
            if (url == null) {
                url = getResourceViaContext(resource);
            }
        } else {
            url = getResourceViaContext(resource);
            if (url == null) {
                url = getResourceViaClasses(resource, classes);
            }
        }
        return url == null ? ClassLoaderHelper.class.getResource(resource)
                : url;
    }
If classesFirst is false, retrieves the resource via the context class loader of the current
thread, and if not found, via the class loaders of the optionally specified classes in the
order of their specification, and if not found, from the class loader of
{@link ClassLoaderHelper} as the last resort.
<p>
If classesFirst is true, retrieves the resource via the optionally specified classes in the
order of their specification, and if not found, via the context class loader of the current
thread, and if not found, from the class loader of {@link ClassLoaderHelper} as the last
resort.

@param resource
           resource to be loaded
@param classesFirst
           true if the class loaders of the optionally specified classes take precedence over
           the context class loader of the current thread; false if the opposite is true.
@param classes
           class loader providers
@return the resource loaded as an URL or null if not found.
aws-java-sdk-code-generator/src/main/java/com/amazonaws/codegen/internal/ClassLoaderHelper.java