Tell you, Spring Boot is really a fast hardware goods!

Spring Boot now very fire, all kinds of technical articles, tutorials variety of pay, abundance, and some may not know Spring Boot, and that it in the end what is it? What is the use? Today to explain in detail.

Spring Boot Spring Boot understand the background of the Spring framework must first talk about!

In today's prosperity Java back-end framework, Spring framework is undoubtedly the most fiery, open-source framework is essential, but sit tight in the back-end Java framework leader.

Used Spring Framework know that Spring is popular because of its two weapon: IOC and AOP, IOC can help us manage object dependencies, greatly reducing coupling objects, while the AOP section features more aspects of the program dynamic proxies to implement the various methods of dynamic features (e.g., transaction, cache, log, etc.).

And to integrate the Spring framework, you must use the XML configuration file, or an annotation-Java code configuration. Whether using XML configuration or the code, you need to have sufficient understanding of the configuration of related components, and then writing a lot of redundant configuration code.

Then how many developers to become proficient configuration? If we only provide some configuration parameters allow the framework to automatically configure these components, it is not so easy?

Based on a simplified quick start for the purpose of Spring, Spring Boot framework was born!

What is Spring Boot? Spring Boot is a sub-project of the Spring open source community, Spring is also a one-stop solution components, mainly to simplify the difficulty of using the Spring framework, burdensome configuration profile Province.

Spring Boot provides various components starter (starters), so long as the developer can configure the corresponding component parameters, Spring Boot automatically configured, so that developers can quickly build Java project depends on Spring components.

Spring Boot not only to create a traditional war package applications, but also to create an independent not dependent on any external container (such as: tomcat) is a standalone application, you can start using the java -jar command. Meanwhile, Spring Boot also provides a command-line tool to perform Spring script.

Spring Boot's official website:

projects.spring.io/spring-boot…

Spring Boot source:

github.com/spring-proj…

Spring Boot design goal if you do not know Spring is doing, then look at what its goals and design the original intention!

• Provide a faster for the Spring application development, easier-to-use entry-experience;

Provide a series of large-scale projects in public frequently used non-functional characteristics, such as: embedded within the server, security, metrics, health monitoring, configuration externalization;

Zero and zero code is configured to generate the XML configuration;

Spring Boot Why can such a fire? Spring Boot Why can such a fire? Because it has the following characteristics.

1, independent operation

Spring Boot embedded in a variety of Servlet containers, Tomcat, Jetty, and now no longer need to deploy war package labeled container, Spring Boot labeled as long as an executable jar package can be run independently, all dependencies are an inner jar package.

2, a simplified configuration Maven

As shown above, now only dependent spring-boot-starter-web-start packet, which contains all web developers all rely, Spring Web can have the ability to greatly simply maven less dependent configuration.

Use Maven command: mvn dependency: tree can also see the complete dependency tree:

3, automatic configuration

Spring Boot according to come under the category of the current class path or class jar packets inside to automatically configure Spring Bean, such as adding a spring-boot-starter-web can have a web-start function, no additional configuration. You can also add in the configuration file to customize the configuration assembly, which will be mentioned later in the course, please pay attention to the follow-up content.

4, no code generation and configuration XML

Spring Boot configuration process without code generation, XML configuration file does not need to complete all the configuration work, all this is done by means of the condition notes, this is one of the core functions of Spring 4+.

5, application monitoring Spring Boot offers a range of services and applications can be monitored endpoints can do health testing for Spring applications.

Shortcoming Spring Boot said the benefits and features of so many Spring Boot, although it is easy to get started, but it is not without drawbacks. Any framework has its advantages and disadvantages, Spring Boot is no exception, I could probably summarize There are several disadvantages.

1, need to be very understanding of core technical principles Spring Boot, otherwise the event of a problem very difficult. Because everything integrated, automatic configuration of. Thus, the need to be very familiar with the configuration information, looking from the issue did not come easily.

2, difficult to smooth migration from the original project to the Spring framework Spring Boot up, because some of the historical old XML configuration can not be configured through Java, require additional XML file is not perfect. Another example, before an independent Tomcat, what parameters are configured online, and you change the built-in Tomcat will encounter many problems.

Its strengths relative to these shortcomings are nothing. In short, Spring Boot is worth any Java developer trying to fumble.

Guess you like

Origin juejin.im/post/5ceb977ef265da1bbc6fb3c7