@Override public URL getResourceUrl(String resourcePath) { if (!isValidResourcePath(resourceBasePath, resourcePath)) { log.warn("Request for '{}' which is not located in '{}'", resourcePath, resourceBasePath); return null; } String resourceName = getResourceBasePath() + "/" + resourcePath; String artifactPath = resourcePath.substring(0, resourcePath.indexOf('/') + 1); if (pathAliases.containsKey(artifactPath)) { String artifactVersion = pathAliases.get(artifactPath); // Do not replace already fixed-version paths. // i.e. skip replacing first path segment of "/jquery/1.11.1/jquery.min.js" // BUT do replace first path segment of "jquery/jquery.min.js". if (!resourcePath.startsWith(artifactVersion)) { String aliasedPath = artifactVersion + resourcePath.substring(artifactPath.length()); log.trace("Replaced Webjar path {} with {}", resourcePath, aliasedPath); resourceName = getResourceBasePath() + "/" + aliasedPath; } } URL url = this.getClass().getClassLoader().getResource(resourceName); if (url == null) { log.warn("Resource '{}' not found", resourceName); } return url; }