Analysis of the starting principle of spring boot jar
1. Preface
Recently, when I was free to optimize the company's open API platform, I suddenly thought that I was familiar with spring boot before, but I never knew the startup principle of the jar played by spring boot. Then I untied the jar this time. It is really very different from what I thought. The following is a complete analysis of the decompressed jar.
2. Jar structure
The application of spring boot will not be posted. The structure of a relatively simple demo is similar. In addition, the version of spring boot I use is 1.4 1. There is another article on release that analyzes the startup of spring boot jar. It should be less than 1.4, and the startup mode is also different from the current version.
After MVN clean install, when we check the target directory, we will find two jar packages, as follows:
This is due to the mechanism of the spring boot plug-in, which turns an ordinary jar into an executable jar package, and XXX jar. Original is the jar package made by Maven. You can refer to the article on the spring official website for details, as follows:
http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#executable -jar