public static Resource toFileSystemResource(final File artifact) throws Throwable {
        val canonicalPath = FunctionUtils.doUnchecked(artifact::getCanonicalPath);
        FunctionUtils.throwIf(artifact.exists() && !artifact.canRead(),
            () -> new IllegalArgumentException("Resource " + canonicalPath + " is not readable."));
        return new FileSystemResource(artifact);
    }
To file system resource.

@param artifact the artifact
@return the resource
@throws Throwable the throwable
core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/ResourceUtils.java