Class ExecutableArchiveLauncher

java.lang.Object
org.springframework.boot.loader.Launcher
org.springframework.boot.loader.ExecutableArchiveLauncher
Direct Known Subclasses:
JarLauncher, WarLauncher

public abstract class ExecutableArchiveLauncher extends Launcher
Base class for executable archive Launchers.
Since:
1.0.0
Author:
Phillip Webb, Andy Wilkinson, Madhura Bhave, Scott Frederick
  • Field Details

  • Constructor Details

    • ExecutableArchiveLauncher

      public ExecutableArchiveLauncher()
    • ExecutableArchiveLauncher

      protected ExecutableArchiveLauncher(Archive archive)
  • Method Details

    • getClassPathIndex

      protected org.springframework.boot.loader.ClassPathIndexFile getClassPathIndex(Archive archive) throws IOException
      Throws:
      IOException
    • getMainClass

      protected String getMainClass() throws Exception
      Description copied from class: Launcher
      Returns the main class that should be launched.
      Specified by:
      getMainClass in class Launcher
      Returns:
      the name of the main class
      Throws:
      Exception - if the main class cannot be obtained
    • createClassLoader

      protected ClassLoader createClassLoader(Iterator<Archive> archives) throws Exception
      Description copied from class: Launcher
      Create a classloader for the specified archives.
      Overrides:
      createClassLoader in class Launcher
      Parameters:
      archives - the archives
      Returns:
      the classloader
      Throws:
      Exception - if the classloader cannot be created
    • getClassPathArchivesIterator

      protected Iterator<Archive> getClassPathArchivesIterator() throws Exception
      Description copied from class: Launcher
      Returns the archives that will be used to construct the class path.
      Specified by:
      getClassPathArchivesIterator in class Launcher
      Returns:
      the class path archives
      Throws:
      Exception - if the class path archives cannot be obtained
    • isSearchCandidate

      protected boolean isSearchCandidate(Archive.Entry entry)
      Determine if the specified entry is a candidate for further searching.
      Parameters:
      entry - the entry to check
      Returns:
      true if the entry is a candidate for further searching
      Since:
      2.3.0
    • isNestedArchive

      protected abstract boolean isNestedArchive(Archive.Entry entry)
      Determine if the specified entry is a nested item that should be added to the classpath.
      Parameters:
      entry - the entry to check
      Returns:
      true if the entry is a nested item (jar or directory)
    • isPostProcessingClassPathArchives

      protected boolean isPostProcessingClassPathArchives()
      Return if post-processing needs to be applied to the archives. For back compatibility this method returns true, but subclasses that don't override postProcessClassPathArchives(List) should provide an implementation that returns false.
      Returns:
      if the postProcessClassPathArchives(List) method is implemented
      Since:
      2.3.0
    • postProcessClassPathArchives

      protected void postProcessClassPathArchives(List<Archive> archives) throws Exception
      Called to post-process archive entries before they are used. Implementations can add and remove entries.
      Parameters:
      archives - the archives
      Throws:
      Exception - if the post-processing fails
      See Also:
    • getArchiveEntryPathPrefix

      protected String getArchiveEntryPathPrefix()
      Return the path prefix for entries in the archive.
      Returns:
      the path prefix
    • isExploded

      protected boolean isExploded()
      Description copied from class: Launcher
      Returns if the launcher is running in an exploded mode. If this method returns true then only regular JARs are supported and the additional URL and ClassLoader support infrastructure can be optimized.
      Overrides:
      isExploded in class Launcher
      Returns:
      if the jar is exploded.
    • getArchive

      protected final Archive getArchive()
      Description copied from class: Launcher
      Return the root archive.
      Overrides:
      getArchive in class Launcher
      Returns:
      the root archive