Package de.gematik.epa.ps.utils
Class SpringUtils
java.lang.Object
de.gematik.epa.ps.utils.SpringUtils
Collection of static methods dealing with Spring specific functionality
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.springframework.core.io.ResourcefindReadableResource(@NonNull org.springframework.core.io.ResourceLoader resourceLoader, @NonNull String resourcePath) Find a resource, using a Spring ResourceLoader, and being a bit smart about it.
Looks for the resource using the given path as it is, within the classpath and finally by comparing it to all resources in the classpath and picking the first one, whose path ends on the given path.
In case no readable resource is found with the given path, throws aMissingResourceException.
-
Constructor Details
-
SpringUtils
public SpringUtils()
-
-
Method Details
-
findReadableResource
public static org.springframework.core.io.Resource findReadableResource(@NonNull @NonNull org.springframework.core.io.ResourceLoader resourceLoader, @NonNull @NonNull String resourcePath) Find a resource, using a Spring ResourceLoader, and being a bit smart about it.
Looks for the resource using the given path as it is, within the classpath and finally by comparing it to all resources in the classpath and picking the first one, whose path ends on the given path.
In case no readable resource is found with the given path, throws aMissingResourceException.- Parameters:
resourceLoader- the SpringResourceLoaderto useresourcePath- the path of the resource- Returns:
- the resource, if it is readable
-