Overview of Java Spring

1. What is Spring?

Spring is a mainstream Java EE lightweight open source framework. Spring was proposed and founded by "Father of Spring" Rod Johnson. Its purpose is to simplify the development difficulty and development cycle of Java enterprise applications. The use of Spring is not limited to server-side development. Any Java application can benefit from Spring in terms of simplicity, testability, and loose coupling. In addition to providing its own functions, the Spring framework also provides the ability to integrate other technologies and frameworks.

Spring has been favored since its inception, and has been regarded as the first choice by developers for Java enterprise application development. Today, Spring has become synonymous with Java EE and the preferred standard for building Java EE applications.

Since the official release of Spring 1.0 in April 2004, Spring has entered the sixth major version.

insert image description here

GA: That is, the officially released version, which is officially recommended for widespread use. Some foreign countries use GA to indicate the release version.

2. The narrow and broad sense of Spring

In different contexts, Spring represents different meanings. The following introduces Spring from the perspectives of "broad sense" and "narrow sense".

Spring in a broad sense: Spring technology stack

Spring in a broad sense refers to the Spring technology stack Spring Frameworkwith the core as the core.

After more than ten years of development, Spring is no longer a pure application framework , but has gradually developed into a mature technology composed of multiple different sub-projects (modules), such as Spring Framework, Spring MVC, SpringBoot, Spring Cloud, Spring Data, Spring Securityetc., among which Spring Framework is The basis for other subprojects .

These sub-projects cover everything from enterprise-level application development to cloud computing, and can help developers solve various practical problems that arise in the process of software development, bringing developers a better development experience.

Narrow Spring: Spring Framework

In a narrow sense Spring Framework, Spring refers specifically to it, and we usually refer to it as the Spring framework.

The Spring framework is a one-stop lightweight solution for layered , aspect-oriented Java applications. It is the core and foundation of the Spring technology stack and was created to solve the complexity of enterprise-level application development.

Spring has two core modules : IoCand AOP.

IoC : Short for Inverse of Control , translated as " inversion of control ", which refers to handing over the process of creating objects to Spring for management .

AOP : Short for Aspect Oriented Programming , translated as " Aspect Oriented Programming ". AOP is used to encapsulate the public behavior of multiple classes, and encapsulate the logic that has nothing to do with business but is commonly called by business modules, so as to reduce the duplication of code in the system and reduce the coupling between modules. In addition, AOP also solves some system-level problems, such as logs, transactions, permissions, etc.

3. Spring Framework Features

  • Non-intrusive : When developing an application using the Spring Framework, Spring has very little impact on the structure of the application itself. Zero pollution can be achieved to the domain model; only a few simple annotations are required to mark the functional components, which will not destroy the original structure at all, but can further simplify the component structure. This makes the structure clear, concise and elegant when developing applications based on Spring Framework.

  • Inversion of Control : IoC——Inversion of Control , which reverses the direction of resource acquisition. Turn creating resources by yourself and requesting resources from the environment into the environment preparing resources, and we enjoy resource injection.

  • Aspect Oriented Programming : AOP——Aspect Oriented Programming , which enhances code functions without modifying source code.

  • Container : Spring IoC is a container because it contains and manages the lifecycle of component objects. Components enjoy containerized management, which shields programmers from a large number of details in the component creation process, greatly reduces the threshold for use, and greatly improves development efficiency.

  • Componentization : Spring realizes the combination of simple component configurations into a complex application. These objects can be combined in Spring using XMLand Javaannotations. This allows us to build super-large and complex application systems in an orderly manner based on components with clear functions and clear boundaries.

  • One-stop shop : On the basis of IoC and AOP, open source frameworks and excellent third-party class libraries of various enterprise applications can be integrated. Moreover, the projects under Spring have covered a wide range of fields, and many functional requirements can be realized using Spring on the basis of Spring Framework.

4. Spring module composition

Official website address: https://spring.io/

insert image description here

insert image description here

The above figure contains all the modules of the Spring framework. These modules can meet the needs of all enterprise-level application development. During the development process, the required modules can be selectively used according to the requirements. The functions of these modules are briefly introduced below.

①Spring Core (core container)

Spring core provides the core implementation of IOC, DI, and Bean configuration loading creation. Core concepts: Beans, BeanFactory, BeanDefinitions, ApplicationContext.

  • spring-core: Basic implementation of IOC and DI

  • spring-beans: BeanFactory and Bean assembly management (BeanFactory)

  • spring-context: Spring context context, that is, IOC container (AppliactionContext)

  • spring-expression: spring expression language

②Spring AOP

  • spring-aop: Application module for aspect programming, integrating ASM, CGLib, JDK Proxy
  • spring-aspects: Integrate AspectJ, AOP application framework
  • spring-instrument: Dynamic Class Loading module

③Spring Data Access

  • spring-jdbc: Spring's encapsulation of JDBC to simplify jdbc operations
  • spring-orm: The mapping framework between java objects and database data
  • spring-oxm: A mapping framework for objects and xml files
  • spring-jms: Spring's encapsulation of Java Message Service (java message service), used for mutual communication between services
  • spring-tx: spring jdbc transaction management

④Spring Web

  • spring-web: The most basic web support, built on spring-context, initializes the IOC container through servlet or listener
  • spring-webmvc: Implement web mvc
  • spring-websocket: full-duplex communication protocol with the front end
  • spring-webflux: Provided by Spring 5.0, used to replace traditional java servlet, non-blocking Reactive Web framework, asynchronous, non-blocking, event-driven services

⑤Spring Message

  • Spring-messaging: Provided by spring 4.0, it integrates some basic message delivery services for Spring

⑥Spring test

  • spring-test: Integration test support, mainly the encapsulation of junit

5. Spring 6 version requirements

Spring version requirements

Spring6 requires the minimum version of JDK to be JDK17

insert image description here

Guess you like

Origin blog.csdn.net/weixin_43847283/article/details/130935802