Spring Boot playing war bag and jar package directory structure simple explanation

Spring Boot project jar package and can be made into war package, which is not the same directory structure, specifically as follows:

1, war package directory structure analysis
WAR (Web Archivefile) network application files, are platform-independent file format, which allows to combine many files into a compressed file.

WAR package standard directory structure:

 

Description:

1, index.jsp [optional]

2, METAINF [MAVEN automatically catalogs]

3, WEB-INF [mandatory]

①classes directory: store Java class files

②lib directory: jar package needed

③web.xml: war's profile

4, subdirectories [optional directory]

      Store some pages and photographs, such as: html, jsp, js, jpg and so on.

2, jar package directory structure analysis
example.jar
 |
 + -META-INF
 | + -MANIFEST.MF
 + -org
 | + -springframework
 | + -boot
 | + -loader
 | + - <classes Spring Boot Loader>
 + -BOOT- INF
    + -classes
    | + -mycompany
    | -project +
    | + -YourClasses.class
    + -lib
       + -dependency1.jar
       + -dependency2.jar
Description:

SpringBoot bootstrap class is provided outermost in a package, such as the above org.springframework.boot.loader.

Code of the application is the need to put BOOT-INF / classes directory; a jar file and other applications that rely on the need to put the BOOT-INF / lib directory.
When the jar as standardalone program runs (not into container), SpringBoot Main-Class can be disposed in the generated META-INF / MANIFEST.MF inside into org.springframework.boot.loader.JarLauncher, JarLauncher creates a class own spring ClassLoader: LaunchedURLClassLoader, will be able to load the classloader BOOT-INF / lib inside the package depends above by its URL, and is defined by the inside reflection Manifest Start-class which class this class and invoke the main method which .



Reference link: https: //blog.csdn.net/chao821/article/details/88650674

Guess you like

Origin www.cnblogs.com/xiohao/p/11965971.html