Three Java framework learning: Introduction to SpringBoot

1. Introduction to SpringBoot

1.1 Analysis of the advantages and disadvantages of the original Spring

1.1.1 Analysis of the advantages of Spring

Spring is a lightweight alternative to Java Enterprise Edition (Java Enterprise Edition, JEE, also known as J2EE). No need to develop heavyweight Enterprise JavaBean (EJB),
Spring provides a relatively simple method for enterprise-level Java development,
through dependency injection (IOC) and aspect-oriented programming (AOP),
using simple Java objects (Plain Old Java Object) , POJO) realizes the function of EJB.

1.1.2 Analysis of the shortcomings of Spring

Although Spring's component code is lightweight, its configuration is heavyweight.
In the beginning, Spring used XML configuration, and it was a lot of XML configuration.
Spring 2.5 introduces annotation-based component scanning, which eliminates a lot of explicit XML configuration for the application's own components. Spring 3.0 introduces Java-based configuration, which is a type-safe and reconfigurable configuration method that can replace XML.

All these configurations represent losses during development.
Because of the need to switch thinking between thinking about Spring feature configuration and solving business problems,
writing configuration squeezes time for writing application logic.
Like all frameworks, Spring is practical, but at the same time it requires a lot of rewards.

In addition, the dependency management of the project is also a time-consuming and labor-intensive thing.
When setting up the environment, you need to analyze the coordinates of which libraries you want to import,
and you also need to analyze the coordinates of other libraries that are dependent on it.
Once you choose the wrong version of the dependency, the incompatibility issues that follow will seriously hinder The development progress of the project.

1.2 Overview of SpringBoot

1.2.1 SpringBoot solves the above shortcomings of Spring

SpringBoot's improvement and optimization of the above-mentioned Spring shortcomings are based on the idea that conventions are better than configuration,
so that developers do not have to switch their thinking between configuration and logical business, and
devote themselves to the coding of logical business. Greatly improve the efficiency of development
and shorten the project cycle to a certain extent.

1.2.2 Features of SpringBoot

  • Provide a faster entry experience for Spring-based development
  • It works out of the box, no code generation, and no XML configuration. At the same time, the default value can also be modified to meet specific needs
  • Provides some non-functional features common in large-scale projects, such as embedded server, security, indicators, health detection, external configuration, etc.
  • SpringBoot is not an enhancement of Spring functionality, but provides a quick way to use Spring

1.2.3 Core functions of SpringBoot

  • Start-up dependence

    The initial dependency is essentially a Maven project object model (Project Object Model, POM), which defines transitive dependencies on other libraries. Together, these things support a certain function.

    Simply put, the initial dependency is to pack the coordinates with a certain function together and provide some default functions.

  • Automatic configuration

    Spring Boot's automatic configuration is a process at runtime (more precisely, when the application starts). Many factors are considered before deciding which Spring configuration should be used and which should not be used. This process is done automatically by Spring.

Guess you like

Origin blog.csdn.net/m0_51684972/article/details/115057150