Class JarUtils


  • public class JarUtils
    extends java.lang.Object
    Utility to access jar files
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String normalizeSpringBootResourceUrlPath​(java.lang.String resourceUrlPath)
      Spring Boot executable jar contains path "BOOT-INF/classes/org/example/MyClass.class" in the jar file.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • normalizeSpringBootResourceUrlPath

        public static java.lang.String normalizeSpringBootResourceUrlPath​(java.lang.String resourceUrlPath)
        Spring Boot executable jar contains path "BOOT-INF/classes/org/example/MyClass.class" in the jar file. However, when resource urls are acquired by spring boot classloader's getResources(), "!" is added to the path prefix as a "nest" separator, resulting in "BOOT-INF/classes!/org/example/MyClass.class". This method removes the "!" from the path to make it consistent with the actual path in the jar file.
        Parameters:
        resourceUrlPath - resource url path
        Returns:
        normalized resource url path