Ali P9 tell you that Spring Boot 2.0 is officially released, or not rise?

Source: Internet
Author: User

Spring Empire
Spring is a development framework that is familiar to every Java developer, whether you are a novice programmer or an experienced old driver who has some experience in understanding or using it. In a modern enterprise application architecture, the spring technology stack is almost synonymous with the Java language, so why is spring able to stand out among the many open source frameworks and become an industry-recognized technology solution? Let's start with the original spring framework and see why it annihilation, unified!

Challenge Authority, fame in World War One

In March 2004, the first version of spring and its founder Rod Johnson's classic masterpiece "Expert One-on-one development Without EJB" released, breaking the traditional thinking mode in Java development, Enterprise applications are beginning to move toward a "light weight" development.

The initial Spring Framework 1.0 is not as complex as today's spring, but it already contains two of the most central elements of spring: Dependency Injection (IOC) and aspect-oriented programming (AOP), which are two features that spring distinguishes from other excellent frameworks , and the key to building a core position in enterprise applications. Many developers are likely to feel that the two features are not very significant when they start with Java applications, because we can still implement business functions well without them, but with the deepening of business iterations and development, the complex and varied requirements begin to erode the original "perfect" architecture. The difficulty of development and testing gradually increased, often at this time, we only realized the value of spring. So, even in the initial version of spring, there are many business-biased feature packages, such as mail sending, transaction management, and so on, but we need to know that the reason why the enterprise-class application cannot be separated from the spring is not the functions that are directly related to the business. It is the two cores mentioned above that are irrelevant to the implementation of the business.

Since spring is not so powerful for many functional packages in the early versions, we have spent a long time using spring engineering to integrate other better functional frameworks to complete the architecture of system development, such as the once Rage Spring + Struts + Hibernate architecture, I believe can remind a generation of memories.

Elegant and flexible, powder-absorbing countless

Spring's open source community has become extraordinarily active following the release and recognition of the industry, and other functional frameworks have adapted and supported spring in addition to the community's own ongoing enhancements to spring. In the subsequent releases of spring 2.x and 3.x, the graceful configuration of annotation and the configuration of more flexible Java classes were supported successively, which made spring more diversified in managing the way beans are configured.

But with the deep application of spring, cumbersome configuration problems are also beginning to appear, we will find every time in the construction of the project is always in the continuous replication paste some of the template configuration and code, sometimes we just want to implement a few very simple functions, the result configuration is much larger than the writing of business logic code; During the framework integration process, there is a potential conflict risk for some common-dependent jar packages, making complex integration tasks difficult. As a result, Spring's "lightweight" is less light in the face of other dynamic languages.
With 1-5 working experience, in the face of the current popular technology do not know where to start, need to break through the technical bottleneck can add group. Stay in the company for a long time, have a very comfortable, but job-hopping interview wall. Need to study in a short period of time, job-hopping to get a high salary can add group. If there is no work experience, but the foundation is very solid, on the Java work mechanism, common design ideas, Common Java Development Framework Master skilled can add group. Java Architecture Group: 5,825,056,431 communication.

Wheel Master, the future is uncertain

In addition to providing support for Java 8 and enhancements to dependency injection in the later Spring 4.x, the spring community has been less innovative in its core framework, and the community has been more focused on turning to the once-intimate partners. As a result, we found a variety of functional sibling projects in the spring community, such as the spring data for simplifying access to the database, the spring batch that provides batch processing power, and the spring security for securing the application.

Although these frameworks have certain advantages and advanced concepts from the individual, it is difficult for many existing systems to make changes in the functional framework, which is difficult to apply for these newborn wheel projects, except that some of the zero-based systems will do some experimenting, considering the cost of learning and the risk of stepping on the pit, Small and medium teams are rarely willing to try on these new projects. So, some old-style functional frameworks are hard to replace with these wheels unless they have serious performance or security problems.

During this time, although the spring community launched so many wheel projects, but really not much in the domestic application, many development teams are still only using the most core IOC and AOP, and according to their own team's technical stack to integrate more suitable for their own scaffolding for system development.

The birth of the Divine soldiers, and create brilliant

Spring Boot released its first official version on April 1, 2014. The project is designed to help developers make it easier to create spring-based applications and services, enabling existing and new spring developers to get the spring functionality they need most quickly. Until today's release of the 2.x version, a total of nearly 4 years of development, Spring boot has been a more than 21,000 star,15000 multiple commits, contributors more than 400 of the super-hot open source projects.

Why has Spring boot suddenly been so much appreciated and respected? The main points are as follows:

Simplified dependency Management: A series of starter POMs are provided in spring boot, and various functional modules are partitioned and encapsulated, making it easier to introduce and use Effectively avoids issues such as jar conflicts caused by users maintaining a large number of dependencies while building traditional spring applications.
Automated configuration: Spring Boot provides an automated Java configuration class for each starter that replaces our traditional Spring application's cumbersome and not-changing bean configuration in XML, with a series of conditional annotation adornments Allows us to easily replace these automation-configured beans for expansion.
Embedded containers: In addition to the optimization of the code organization, the embedded containers supported in Spring boot are also a great highlight (as if you heard Josh Long again here: "Deploy as a Jar, not a War"), this feature makes spring The package run of the boot app has become very lightweight.
Production-level monitoring endpoint: the launch of Spring-boot-starter-actuator can be said to be another important innovation on spring based on spring boot, making the engineering of spring applications even more perfect. The module does not enable us to implement any business functions, but it gives us more support at the architecture operations level, which allows us to easily understand and control the operation of the spring boot application through the HTTP interface exposed by the module.
Spring boot is built based on spring, but the support of these features has changed the way we use spring, greatly simplifying the configuration of building enterprise applications, especially for many beginners, making it easier to get started.

Spring Boot 2.0 to the same, upgrade or not?
The long-awaited Spring Boot 2.0 finally released its first official version, why is Spring Boot 2.0 so expected? I think there are several main reasons for this:

Support for the latest Java 9
Based on the Spring 5 build, spring's new features can be used in Spring Boot 2.0
Provides automated configuration for responsive programming of various components such as reactive spring Data, reactive spring security, etc.
Non-blocking alternatives for spring MVC Webflux and embedded Netty Server
Will spring Cloud Finchley be far behind the release of Spring Boot 2.0?
The above-mentioned content is the main concern of the author, not the Spring Boot 2.0 all the new features, for different users believe there will be a different point of concern. In addition, there are a number of other exciting new features in Spring Boot 2.0, such as support for HTTP/2, the addition of a more flexible property binding API (which can be read and used without @configurationproperties annotations) , simplified configuration of spring Security integration, enhancements to Gradle plug-ins, optimization of actuator modules, and more. This article does not introduce these new features in detail, the following mainly say, we need to upgrade our Spring boot 1.x to spring boot 2.x, in the process, we have to consider and pay attention to which issues.

Changes in Java version requirements

When we choose whether to upgrade Spring boot, the first thing to consider is the Java version of the selection. In spring Boot 2.0, the requirement for a Java version has been increased, and we need to use Java 8 at least to use it, and if your spring boot application is running on Java 7, you have to consider the cost of upgrading Java.

Also, whether or not you want to use Java 9 over the next period of time will be an important decision-making basis for the upgrade or not, because the spring boot 1.x version clearly illustrates the absence of a support plan for Java 9, in other words, if you want to run spring boot on Java 9, Then you must upgrade to Spring Boot 2.0.

Tips: The current version of Spring Boot 2.0 supports Java 9, but there are still some issues. For example: The JDK proxy support requires the use of ASPECTJ 1.9, but this version is still in RC version, the Apache Cassandra is not supported, and for JSP TLDs in embedded Tomcat can not support the situation. The specific approach to these issues is visible: Running Spring Boot on Java 9
Upgrade of dependent components

Spring Boot's starter incorporates a number of excellent third-party components, and the upgrade of these components requires some consideration as to whether there are any changes in the use of these components during the version upgrade process. Of these, the most critical components require our attention:
With 1-5 working experience, in the face of the current popular technology do not know where to start, need to break through the technical bottleneck can add group. Stay in the company for a long time, have a very comfortable, but job-hopping interview wall. Need to study in a short period of time, job-hopping to get a high salary can add group. If there is no work experience, but the foundation is very solid, on the Java work mechanism, common design ideas, Common Java Development Framework Master skilled can add group. Java Architecture Group: 5,825,056,431 communication.
? Tomcat upgrade to 8.5
Flyway upgrade to 5
Hibernate upgrade to 5.2
Thymeleaf upgrade to 3
Tips: Tomcat vulnerabilities exposed in previous days. The version selected by Spring Boot 2.0 is 8.5.28, which belongs to the security version, so you can use it with confidence.
Dependent reassembly and configuration relocation

In the Spring Boot 2.0 upgrade process, this part of the content will be to make a lot of changes in the place, so we suggest you leave a mind here. Since spring boot is not a flat structure when building starter poms, some function modules starter have a referential relationship between them, For example: Spring-boot-starter-thymeleaf contains Spring-boot-starter-web, because the Thymeleaf template engine must have been used under spring MVC. However, in Spring Boot 2.0, the advent of Webflux is no longer unique for Web application solutions, so dependencies in Spring-boot-starter-thymeleaf are not included Spring-boot-starter-web , developers need to add spring-boot-starter-web or spring-boot-starter-webflux themselves to decide which module to use to implement the Web App.

In addition to the above-mentioned dependency reorganization, the relocation of the configuration attribute in Spring Boot 2.0 is also much more, which will result in some of the original configuration will no longer take effect, we need to manually modify these configuration key to complete the upgrade adaptation. For example, some servlet-related server.* properties are relocated to the Server.servlet prefix:

New Property
Server.context-parameters. server.servlet.context-parameters.
Server.context-path Server.servlet.context-path
Server.jsp.class-name Server.servlet.jsp.class-name
Server.jsp.init-parameters. server.servlet.jsp.init-parameters.
Server.jsp.registered server.servlet.jsp.registered
Server.servlet-path Server.servlet.path
More dependent changes, configuration relocation and changes to the default configuration, readers can check their own official upgrade manuals: Spring Boot 2.0 Migration Guide

Unnecessary concerns.

Before a friend in the Spring4all community asked: If the spring boot upgrade 2.0,2.0 out so many new features, whether our business code also need to be modified, the risk will be great? In fact, there is no need to worry about this problem, Spring Boot 2.0 has added a lot of powerful new features, but the support for the original feature has not been abandoned. So, even if we don't use any new features like Webflux, after upgrading the project to Spring Boot 2.0, it's completely unaffected to continue using spring MVC to develop our project. Just as mentioned above, we may need to make some dependencies and configuration adjustments to continue to run the app properly.

Summary and Prospect
Thanks to all of you for reading my thin view of Spring Boot 2.0 above, I hope this content will be useful to you in the Spring Boot 2.0 selection. This version does not overturn our understanding of the cumbersome spring application as Spring Boot 1.0 does, but it still reveals the frontiers of many times. At the same time, the release of Spring Boot 2.0 also means that Spring Cloud Finchley is a step closer to being released, as the same thing in this release will bring a lot of exciting content, and I believe this day is not too far away!

For the current migration upgrade of Spring Boot 2.0, as a loyal supporter of spring boot and Spring cloud, this is a must-try thing in time permitting, in the coming time, I also hope to take the time to continue to share some of the problems and gains, and encourage everyone!

Ali P9 tell you that Spring Boot 2.0 is officially released, or not rise?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.