The project structure after the SpringBoot project is packaged (take the jar package as an example)

Root directory
     | - boot- INF 
| - classes
| - lib
| - META- INF | - ORG
  • BOOT-INF directory
    • The .class file corresponding to the project code is stored in the classes directory
    • The lib directory stores the project-dependent packages, which are stored in the form of jar packages (jar files are stored in jar files.
  • META-INF
    • Store the manifest file, its content describes the basic information of the currently executable jar package
    • Among them, there are two main descriptions:
      • Main-Class
        • The entry file describing the jar package (the class where the main method is located)

        • Spring framework is fixed org.springframework.boot.loader.JarLauncher

        • After defining this attribute, there must be a line break

      • Start-Class
        • Describe the full name of the custom main method

  • org
    • Store some related startup classes after packaging SpringBoot project

    • Due to the management and security considerations of SpringBoot, packaging uses the "separate project code and dependency package" method (unlike the previous method of merging all the .class files in the dependency package with the project's .class files), so packaging The later jar / war package still contains the dependent jar package, which does not conform to the jar package specification. The dependent jar package cannot be loaded by the default loader

    • In order to circumvent the jar file specification, SpringBoot use a custom loader to load the entire project, so it is no longer the main entrance when the method of preparation of the project, but the use of org.springframework.boot.loader.JarLauncherthe class, create all custom loaders to load project at startup class

    • Thus, packetized SpringBoot project, only orgthe folder class is class loader AppClassLoader, BOOT-INFfolder and class loader is dependenciesLaunchedURLClassLoader

The structure of the war package is similar to the structure of the jar package, except for a few more directories (such as "WEB-INF /", etc.).

Guess you like

Origin www.cnblogs.com/flying-snake/p/12689801.html