What is the spring

Spring is a layered javaEE/SE full-stack lightweight open source framework.

Liverpoolfc.tv: spring. IO

When we say Spring, we mean the Spring Framework.

Why Learn Spring

Spring characteristics

  • Easy to decouple and easy to develop

    With the IOC container provided by Spring, we can let Spring control the dependencies between objects, avoiding excessive program coupling caused by hard coding. With Spring, users no longer have to write code for low-level requirements such as singleton pattern classes, property file parsing, etc., and can focus on the upper-level applications.

  • Support for AOP programming

    With the AOP capabilities provided by Spring to facilitate aspect oriented programming, many features that are not easy to implement with traditional OOP can be written with AOP.

  • Declarative thing support

    In Spring, things are flexibly managed in a declarative way to improve development efficiency and quality.

  • Convenient program testing

    You can do almost all of your testing in a non-container-dependent programming way, and testing is no longer an expensive operation in Spring, but something you can do on the fly. For example, spring’s support for Junit4 makes it easy to test spring applications using annotations.

  • Easy to integrate with a variety of excellent frameworks

    Spring doesn’t exclude good open source frameworks; instead, it makes them easier to use by providing direct support for all of them.

  • Make the JavaEE API easier to use

    Spring provides a wrapper around many of the more difficult JavaEE apis (JDBC, JavaMail, remote call, etc.), which are much easier to use with spring’s simple wrapper.

  • Java source code classic learning examples

    Spring source design is exquisite, clear structure, ingenuity, everywhere reflects the master of Java design pattern flexible use and profound attainments to Java technology. The Spring framework source code is undoubtedly a best practice example of Java technology.

Benefits of using Spring

  1. Low intrusive design with minimal code pollution
  2. Independent of various application servers, applications based on the Spring framework can truly live up to the promise of coding once, running everywhere
  3. Spring’s DI mechanism reduces the complexity of business object replacement and improves decoupling between components
  4. Spring’s AOP supports centralized management of common tasks such as security, transactions, logging, and so on, providing better reuse
  5. Spring’s ORM and DAO provide good integration with third-party persistence layer frameworks and simplify underlying database access
  6. Spring does not force applications to rely entirely on Spring, and developers are free to choose some or all of the Spring framework

Coupling and cohesion

Coupling: Also known as Coupling, is a measure of the degree of association between modules.

  • In software engineering, coupling refers to dependencies between objects. The higher the coupling between objects, the higher the maintenance cost. Thus, the coupling between the object’s design classes and components is minimal.
  • In software design, coupling degree and cohesion degree are usually used as the criterion to measure the degree of module independence.
  • One of the criteria for partitioning modules is high cohesion and low coupling.

Cohesiveness: Cohesiveness marks how closely the elements of a module are combined with each other. It is a natural extension of the concepts of information concealment and localization.

  • Cohesion measures the relationships within a module from a functional point of view. A good cohesive module should do one thing well.
  • Cohesion and coupling are closely related. A module with high coupling to other modules means low cohesion, and a module with high cohesion means low coupling to other modules.
  • In software design, we should strive for high cohesion and low coupling.

Spring Architecture

The Spring container framework has integrated many modules, which are distributed in the following modules:

  • Core Container
  • Data Access/Integration layer
  • The Web tier
  • AOP (Aspect Oriented Programming) module
  • Instrumentation module is implanted
  • Messaging
  • The Test module

The core of the spring

  • IoC (core of cores) : Inverse of Control. Object creation rights are transferred from the program to the Spring framework.

  • DI:Dependency Injection. When the Spring framework is responsible for creating Bean objects, dependency objects are dynamically injected into Bean components.

  • AOP: Aspect Oriented Programming Enhance the functionality of beans in the IoC container without modifying the source code of the target object.

  • Spring container: Refers to the IoC container with a BeanFactory at the bottom.