org.springframework.core.io

Interface ProtocolResolver

  • Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.


    @FunctionalInterface
    public interface ProtocolResolver
    A resolution strategy for protocol-specific resource handles.

    Used as an SPI for DefaultResourceLoader, allowing for custom protocols to be handled without subclassing the loader implementation (or application context implementation).

    Since:
    4.3
    Author:
    Juergen Hoeller
    See Also:
    DefaultResourceLoader.addProtocolResolver(org.springframework.core.io.ProtocolResolver)
    • Method Detail

      • resolve

        @Nullable
        Resource resolve(java.lang.String location,
                                   ResourceLoader resourceLoader)
        Resolve the given location against the given resource loader if this implementation's protocol matches.
        Parameters:
        location - the user-specified resource location
        resourceLoader - the associated resource loader
        Returns:
        a corresponding Resource handle if the given location matches this resolver's protocol, or null otherwise