As this picture shows, in the Spring IO framework, Spring boot is in the execution layer to see the official explanation for this layer:
The Spring IO execution layer provides domain-specific runtimes (DSRs) for applications built on the IO Foundation modules . A DSR may run standalone without requiring deployment to an external container.
Or cite the official words to illustrate what spring boot does primarily:
Spring Boot reduces the effort needed to create Production-ready, devops-friendly, Xml-free Spring applications. It simplifies bootstrapping of Spring projects with minimal code, implements an extensible set of operational features suc h as automated health checking and metrics endpoints, and supports embedded containers enabling the creation of Self-conta ined executables.
Take a look at some of the key words here:
Production-ready,devops-friendly-mainly focused on the Spring Boot actuator module, providing on-line monitoring of operations related features such as health checking,metrics endpoints, or by providing self-contained executables such as Maven exec, or something like the one jar.
Xml-free-pre-defined a lot of annotation, configuring meta-programming styles.
Spring boot gives me a feeling more like a devops platform in the spring community, integrating and delivering features such as dependency management, deployment automation, and monitoring operations.
Ok, here's the main part of the story. Next, let's analyze how spring boot is organization-dependent. Take a look at the POM structure of its project code.
The first is the root directory of the Pom, such as:
<groupId>org.springframework.boot</groupId>
<artifactid>spring-boot-build</artifactid >
<version>1.2.1.BUILD-SNAPSHOT</version>
<packaging>pom</packaging>
<name>spring Boot build</name>
Very concise, in addition to declaring the Antrun,surefire and Replacer plug-ins, it defines three profiles including Default,integration,ci. There are several points to pay attention to:
1. The default profile declares a series of minimum dependent modules, as follows:
<modules>
<module>spring-boot-dependencies</module>
<module>spring-boot-parent </module>
<module>spring-boot-versions</module>
<module>spring-boot-tools</ module>
<module>spring-boot</module>
<module>spring-boot-autoconfigure</module >
<module>spring-boot-actuator</module>
<module>spring-boot-docs</module>
<module>spring-boot-starters</module>
<module>spring-boot-cli</module>
</modules>
This relationship, especially the parent-child module relationship, is described later.
2. You can focus on Com.google.code.maven-replacer-plugin this plugin, mainly to do property file replacement, and Alibaba Open source Antx maven plugin somewhat similar. Of course, if you're passionate about the filter mechanism of MAVEN's resources, I'm sure you'll prefer this replacer plugin.
Let's take a look at the parent-child module relationship mentioned above, Spring-boot-dependencies is a parent pom, which is configured as follows:
<groupId>org.springframework.boot</groupId>
<artifactid>spring-boot-dependencies</ artifactid>
<version>1.2.1.BUILD-SNAPSHOT</version>
<packaging>pom</packaging >
It enforces the MAVEN version, such as:
<prerequisites>
<maven>3.0.2</maven>
</prerequisites>
And a bunch of dependencies are declared with dependencymanagement, such as:
<properties> <!--Spring Boot--<spring-boot.version>1.2.1.build-snapshot</spring-boot.vers Ion> <!--third party--<activemq.version>5.10.0</activemq.version> <aspectj.version >1.8.4</aspectj.version> <atomikos.version>3.9.3</atomikos.version> <bitronix.version >2.1.4</bitronix.version> <commons-beanutils.version>1.9.2</commons-beanutils.version> < Commons-collections.version>3.2.1</commons-collections.version> <commons-dbcp.version>1.4</ Commons-dbcp.version> <commons-dbcp2.version>2.0.1</commons-dbcp2.version> < Commons-digester.version>2.1</commons-digester.version> <commons-pool.version>1.6</ Commons-pool.version> <commons-pool2.version>2.2</commons-pool2.version> <crashub.version> 1.3.0</crashub.version> <DROPWIZARD-METRICS.VERSION>3.1.0</DROpwizard-metrics.version> <flyway.version>3.0</flyway.version> <freemarker.version>2.3.21& Lt;/freemarker.version> <gemfire.version>7.0.2</gemfire.version> <glassfish-el.version> 3.0.0</glassfish-el.version> <gradle.version>1.6</gradle.version> <groovy.version>2.3.8&
Lt;/groovy.version> <gson.version>2.3</gson.version>
The question is, how spring is testing and managing these non-spring ecosystem dependencies. Mystery everything in the following sample code (the principle is relatively simple, please refer to document 2):
<dependencyManagement>
<dependencies>
<dependency>
<groupId> io.spring.platform</groupid>
<artifactId>platform-bom</artifactId>
<version> 2.0.1.release</version>
<type>pom</type>
<scope>import</scope>
</ dependency>
</dependencies>
</dependencyManagement>
In addition to the Declaration of the jar dependency, the Pom also to maven common plugin made a declaration of dependency, using the MAVEN version plugin students will feel that this is a good habit, right. In addition, there is a plugin git-commit-id-plugin need to pay extra attention, the use of BuildNumber plugin students may well understand the function of plugin.
Finally take a look at the spring-boot-parent, which is a level two parent Pom, as shown below:
Focus on a few points to note:
1. Mixed use of dependencymanagement and dependencies, this is what I like more.
2. It is also important to configure the lifecyclemappingmetadata of the ORG.ECLIPSE.M2E plug-in in detail, which is a boon for those who have introduced the project to eclipse through Maven project.
3. The use of Maven-enforcer-plugin plug-in, this is what I prefer, the current rules are relatively simple, such as:
<rules>
<requireJavaVersion>
<span style= "White-space:pre" > </span>< Version> (1.7,) </version>
</requireJavaVersion>
<requireProperty>
<property >main.basedir</property>
</requireProperty>
<requireProperty>
<property >project.organization.name</property>
</requireProperty>
<requireProperty>
<property>project.name</property>
</requireProperty>
<requireProperty>
<property>project.description</property>
</requireProperty>
</rules>
See Enforcers official documentation for more details, https://maven.apache.org/enforcer/enforcer-rules/https://maven.apache.org/enforcer/enforcer-rules/
4. The use of the Maven-jar-plugin plugin is useful for tools that are compatible with the Java Package API.
Ok, the rest of the module is on the basis of the parent Pom made a number of personality dependence, there is nothing to say, analysis here is OK. Hopefully this article will help the team who aspire to build their own top Pom.
Reference documents:
1. http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#getting-started-introducing-spring-boot
2. Https://dzone.com/articles/how-to-use-spring-io-platform-and-spring-boot-toge?utm_source=Top%205&utm_ Medium=email&utm_campaign=top5%202016-06-10