Package org.springframework.boot.loader
Class ExecutableArchiveLauncher
java.lang.Object
org.springframework.boot.loader.Launcher
org.springframework.boot.loader.ExecutableArchiveLauncher
- Direct Known Subclasses:
JarLauncher
,WarLauncher
Base class for executable archive
Launcher
s.- Since:
- 1.0.0
- Author:
- Phillip Webb, Andy Wilkinson, Madhura Bhave, Scott Frederick
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected ClassLoader
createClassLoader
(Iterator<Archive> archives) Create a classloader for the specified archives.protected final Archive
Return the root archive.protected String
Return the path prefix for entries in the archive.Returns the archives that will be used to construct the class path.protected org.springframework.boot.loader.ClassPathIndexFile
getClassPathIndex
(Archive archive) protected String
Returns the main class that should be launched.protected boolean
Returns if the launcher is running in an exploded mode.protected abstract boolean
isNestedArchive
(Archive.Entry entry) Determine if the specified entry is a nested item that should be added to the classpath.protected boolean
Return if post-processing needs to be applied to the archives.protected boolean
isSearchCandidate
(Archive.Entry entry) Determine if the specified entry is a candidate for further searching.protected void
postProcessClassPathArchives
(List<Archive> archives) Called to post-process archive entries before they are used.Methods inherited from class org.springframework.boot.loader.Launcher
createArchive, createClassLoader, createMainMethodRunner, launch, launch
-
Field Details
-
BOOT_CLASSPATH_INDEX_ATTRIBUTE
- See Also:
-
DEFAULT_CLASSPATH_INDEX_FILE_NAME
- See Also:
-
-
Constructor Details
-
ExecutableArchiveLauncher
public ExecutableArchiveLauncher() -
ExecutableArchiveLauncher
-
-
Method Details
-
getClassPathIndex
protected org.springframework.boot.loader.ClassPathIndexFile getClassPathIndex(Archive archive) throws IOException - Throws:
IOException
-
getMainClass
Description copied from class:Launcher
Returns the main class that should be launched.- Specified by:
getMainClass
in classLauncher
- Returns:
- the name of the main class
- Throws:
Exception
- if the main class cannot be obtained
-
createClassLoader
Description copied from class:Launcher
Create a classloader for the specified archives.- Overrides:
createClassLoader
in classLauncher
- Parameters:
archives
- the archives- Returns:
- the classloader
- Throws:
Exception
- if the classloader cannot be created
-
getClassPathArchivesIterator
Description copied from class:Launcher
Returns the archives that will be used to construct the class path.- Specified by:
getClassPathArchivesIterator
in classLauncher
- Returns:
- the class path archives
- Throws:
Exception
- if the class path archives cannot be obtained
-
isSearchCandidate
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
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 returnstrue
, but subclasses that don't overridepostProcessClassPathArchives(List)
should provide an implementation that returnsfalse
.- Returns:
- if the
postProcessClassPathArchives(List)
method is implemented - Since:
- 2.3.0
-
postProcessClassPathArchives
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
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 returnstrue
then only regular JARs are supported and the additional URL and ClassLoader support infrastructure can be optimized.- Overrides:
isExploded
in classLauncher
- Returns:
- if the jar is exploded.
-
getArchive
Description copied from class:Launcher
Return the root archive.- Overrides:
getArchive
in classLauncher
- Returns:
- the root archive
-