Class SpringUtils

java.lang.Object
de.gematik.epa.ps.utils.SpringUtils

public class SpringUtils extends Object
Collection of static methods dealing with Spring specific functionality
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.springframework.core.io.Resource
    findReadableResource(@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 a MissingResourceException.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 a MissingResourceException.
      Parameters:
      resourceLoader - the Spring ResourceLoader to use
      resourcePath - the path of the resource
      Returns:
      the resource, if it is readable