Utilize new enum for Resource prefixes.

Simplify ResourceLoaderResourceResolver.getResourceLoader() to use the new 'initialize' operator.

Resolves gh-92.
This commit is contained in:
John Blum
2020-07-09 11:59:33 -07:00
parent 433d152c98
commit d21ce7d20a
2 changed files with 3 additions and 6 deletions

View File

@@ -20,7 +20,6 @@ import static org.springframework.data.gemfire.util.RuntimeExceptionFactory.newI
import java.util.Optional;
import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader;
import org.springframework.lang.NonNull;
import org.springframework.util.ClassUtils;
@@ -34,10 +33,6 @@ import org.springframework.util.ClassUtils;
@FunctionalInterface
public interface ResourceResolver {
String CLASSPATH_URL_PREFIX = ResourceLoader.CLASSPATH_URL_PREFIX;
String FILESYSTEM_URL_PREFIX = "file:";
String RESOURCE_PATH_SEPARATOR = "/";
/**
* Gets the {@link ClassLoader} used by this {@link ResourceResolver} to resolve {@literal classpath}
* {@link Resource Resources}.

View File

@@ -15,6 +15,8 @@
*/
package org.springframework.geode.core.io.support;
import static org.springframework.geode.core.util.ObjectUtils.initialize;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicReference;
@@ -94,7 +96,7 @@ public class ResourceLoaderResourceResolver implements ResourceLoaderAware, Reso
*/
protected @NonNull ResourceLoader getResourceLoader() {
return this.resolvedResourceLoader.updateAndGet(resourceLoader ->
resourceLoader != null ? resourceLoader : newResourceLoader());
initialize(resourceLoader, this::newResourceLoader));
}
/**