spring-framework / org.springframework.test.context.util / TestContextResourceUtils

TestContextResourceUtils

abstract class TestContextResourceUtils

Utility methods for working with resources within the Spring TestContext Framework. Mainly for internal use within the framework.

Author
Sam Brannen

Author
Tadaya Tsuyukubo

Since
4.1

See Also
org.springframework.util.ResourceUtilsorg.springframework.core.io.Resourceorg.springframework.core.io.ClassPathResourceorg.springframework.core.io.FileSystemResourceorg.springframework.core.io.UrlResourceorg.springframework.core.io.ResourceLoader

Constructors

<init>

TestContextResourceUtils()

Utility methods for working with resources within the Spring TestContext Framework. Mainly for internal use within the framework.

Functions

convertToClasspathResourcePaths

open static fun convertToClasspathResourcePaths(clazz: Class<*>, vararg paths: String): Array<String>

Convert the supplied paths to classpath resource paths.

For each of the supplied paths:

  • A plain path — for example, "context.xml" — will be treated as a classpath resource that is relative to the package in which the specified class is defined.
  • A path starting with a slash will be treated as an absolute path within the classpath, for example: "/org/example/schema.sql".
  • A path which is prefixed with a URL protocol (e.g., classpath:, file:, http:, etc.) will be cleaned but otherwise unmodified.

convertToResourceList

open static fun convertToResourceList(resourceLoader: ResourceLoader, vararg paths: String): MutableList<Resource>

Convert the supplied paths to a list of Resource handles using the given ResourceLoader.

convertToResources

open static fun convertToResources(resourceLoader: ResourceLoader, vararg paths: String): Array<Resource>

Convert the supplied paths to an array of Resource handles using the given ResourceLoader.