类 MainClassFinder
- java.lang.Object
- org.springframework.boot.loader.tools.MainClassFinder
public abstract class MainClassFinder extends Object
Finds any class with apublic static mainmethod by performing a breadth first search.
构造器概要
构造器 构造器 说明 MainClassFinder()
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static StringfindMainClass(File rootFolder)Find the main class from a given folder.static StringfindMainClass(JarFile jarFile, String classesLocation)Find the main class in a given jar file.static StringfindSingleMainClass(File rootFolder)Find a single main class from the givenrootFolder.static StringfindSingleMainClass(File rootFolder, String annotationName)Find a single main class from the givenrootFolder.static StringfindSingleMainClass(JarFile jarFile, String classesLocation)Find a single main class in a given jar file.static StringfindSingleMainClass(JarFile jarFile, String classesLocation, String annotationName)Find a single main class in a given jar file.
构造器详细资料
MainClassFinder
public MainClassFinder()
方法详细资料
findMainClass
public static String findMainClass(File rootFolder) throws IOException
Find the main class from a given folder.- 参数:
rootFolder- the root folder to search- 返回:
- the main class or
null - 抛出:
IOException- if the folder cannot be read
findSingleMainClass
public static String findSingleMainClass(File rootFolder) throws IOException
Find a single main class from the givenrootFolder.- 参数:
rootFolder- the root folder to search- 返回:
- the main class or
null - 抛出:
IOException- if the folder cannot be read
findSingleMainClass
public static String findSingleMainClass(File rootFolder, String annotationName) throws IOException
Find a single main class from the givenrootFolder. A main class annotated with an annotation with the givenannotationNamewill be preferred over a main class with no such annotation.- 参数:
rootFolder- the root folder to searchannotationName- the name of the annotation that may be present on the main class- 返回:
- the main class or
null - 抛出:
IOException- if the folder cannot be read
findMainClass
public static String findMainClass(JarFile jarFile, String classesLocation) throws IOException
Find the main class in a given jar file.- 参数:
jarFile- the jar file to searchclassesLocation- the location within the jar containing classes- 返回:
- the main class or
null - 抛出:
IOException- if the jar file cannot be read
findSingleMainClass
public static String findSingleMainClass(JarFile jarFile, String classesLocation) throws IOException
Find a single main class in a given jar file.- 参数:
jarFile- the jar file to searchclassesLocation- the location within the jar containing classes- 返回:
- the main class or
null - 抛出:
IOException- if the jar file cannot be read
findSingleMainClass
public static String findSingleMainClass(JarFile jarFile, String classesLocation, String annotationName) throws IOException
Find a single main class in a given jar file. A main class annotated with an annotation with the givenannotationNamewill be preferred over a main class with no such annotation.- 参数:
jarFile- the jar file to searchclassesLocation- the location within the jar containing classesannotationName- the name of the annotation that may be present on the main class- 返回:
- the main class or
null - 抛出:
IOException- if the jar file cannot be read