What layer is the spring framework

Spring Framework

The Spring Framework is a layered architecture consisting of seven well-defined modules.The Spring modules are built on top of the core container, which defines how beans are created, configured, and managed, as shown in Figure 1.

Each of the modules (or components) that make up the Spring framework can stand alone or be implemented in conjunction with one or more other modules. The function of each module is as follows:

Core Container: The core container provides the basic functionality of the Spring Framework. The main component of the core container is the BeanFactory, which is an implementation of the factory pattern.The BeanFactory uses the Inversion of Control (IOC) pattern to separate the configuration and dependency specifications of the application from the actual application code.

Spring Context: A Spring context is a configuration file that provides contextual information to the Spring Framework.Spring contexts include enterprise services such as JNDI, EJB, email, internationalization, checksums, and scheduling capabilities.

SpringAOP: With the configuration management feature, the SpringAOP module integrates aspect-oriented programming capabilities directly into the Spring Framework. So it is easy to make any object managed by the Spring Framework to support AOP. the SpringAOP module provides transaction management services for objects in Spring-based applications . By using SpringAOP, declarative transaction management can be integrated into an application without relying on EJB components.

SpringDAO: The JDBCDAO abstraction layer provides a meaningful exception hierarchy that can be used to manage exception handling and error messages thrown by different database vendors. The exception hierarchy simplifies error handling and greatly reduces the amount of exception code that needs to be written (e.g., to open and close connections.) SpringDAO’s JDBC-oriented exceptions follow the common DAO exception hierarchy.

SpringORM: The Spring Framework plugs into several ORM frameworks to provide object-relational tools for ORM, including JDO, Hibernate, and iBatisSQLMap. all of which follow Spring’s common transaction and DAO exception hierarchy.

SpringWeb Module : The Web Context Module builds on top of the Application Context Module to provide context for Web-based applications. Therefore, the Spring Framework supports integration with JakartaStruts. the Web module also simplifies handling multi-part requests and binding request parameters to domain objects.

SpringMVC Framework : The MVC Framework is a full-featured MVC implementation for building Web applications. Through the policy interface, the MVC framework into a highly configurable , MVC accommodates a large number of view technologies , including JSP, Velocity, Tiles, iText and POI.

Spring framework features can be used in any J2EE server , most of the features are also suitable for unmanaged environment . Spring’s core points are : Support for reusable business and data access objects that are not bound to a specific J2EE service. There is no doubt that such objects can be reused across different J2EE environments (Web or EJB), stand-alone applications, test environments.

Spring Framework Getting Started

Spring is a layered JavaSE/EE (one-stop) lightweight open source container framework to IOC (InverseofControl inversion of control: the relationship between the object created by the container , reducing the dependencies between the program) and AOP ( AspectOrientedProgramming) for the kernel of the container framework

One-stop , layered:

JavaEE’s have a three-tier structure : web tier , business tier , data access layer (persistence layer , integration layer ) , and Spring Framework has a solution for each of the three tiers :

web tier :SpringMVC

Persistence layer: JDBCTemplate (applicationContext.xml)

Business layer: Spring’s Bean management (Bean: is spring according to the user to provide the appropriate requirements for the creation of the object, managed by the IOC) (service)

spring official website: https://spring.io/

Spring’s English translation of spring, it can be said that the Java programmers brought the spring, because it greatly simplifies the development, effectively solving the problem of more complex software development at the time (at the time the use of EJB development of JAVAEE applications, but the existence of the EJB learning) Spring uses basic JavaBean to complete the things that could only be done by EJB before. However, Spring’s uses are not limited to server-side development. From the point of view of simplicity , testability and loose coupling , any Java application can benefit from Spring. It can be said that Spring is a framework that provides a more complete development environment to provide enterprise-class services for POJO (PlainOrdinaryJavaObject) objects.

Spring’s excellent:

1, the most complete lightweight core framework.

2, simplifies the development , easy decoupling

4, integrated Toplink, Hibernate, JDO, andiBATISSQLMaps and other excellent framework.

5, a powerful AOP function : Spring provides cut-oriented programming , you can easily implement the program to intercept permissions , run monitoring and other functions .

6, easy to test the program : Spring on Junit4 support , you can easily test the Spring program through annotations

This is the most basic part of the Spring framework , all Spring modules are built on top of the core container . It provides DependencyInjection (DependencyInjection) feature to achieve container management of beans. The most fundamental concept here is the BeanFactory, which is at the heart of any Spring application.The BeanFactory is an implementation of the Factory pattern that uses IOC (Inversion of Control) to separate application configuration and dependency descriptions from the actual application code.

The core module’s BeanFactory makes Spring a container, while the context module makes it a framework. This module extends the concept of the BeanFactory by adding support for internationalized (I18N) messages, event propagation, and validation (a Spring context is a configuration file that provides contextual information to the Spring Framework).

In addition, this module provides a number of enterprise services such as email, JNDI access, EJB integration, remoting, and scheduling (scheling) services. Support for templating frameworks such as Velocity and FreeMarker integration is also included.

Spring provides rich support for cutter-oriented programming in its AOP module. This module is the foundation for implementing faceted programming in Spring applications. To ensure interoperability between Spring and other AOP frameworks, Spring’s AOP support is based on the APIs defined by the AOP Alliance, an open source project whose goal is to promote the use of AOP and interoperability between different AOP implementations by defining a common set of interfaces and components. You can find out more about the AOP Alliance by visiting their site.

Spring’s AOP module also introduces metadata programming to Spring.Using Spring’s metadata support, you can add annotations to your source code indicating where and how Spring applies faceted functions.

Using JDBC often leads to a lot of repetitive code, obtaining a connection, creating a statement, processing the result set, and then closing the connection.Spring’s JDBC and DAO modules extract this repetitive code, so you can keep your database access code clean and concise, and you can prevent problems caused by failures to close database resources.

This module also builds a meaningful exception layer on top of the error messages given by several database servers. Freeing you from trying to decipher cryptic private SQL error messages!

In addition, this module uses Spring’s AOP module to provide transaction management services for objects in Spring applications.

For those who prefer to use an object/relational mapping tool rather than JDBC directly, Spring provides an ORM module.Spring does not attempt to implement its own ORM solution, but rather provides integrated solutions for several popular ORM frameworks, including Hibernate, JDO, and iBATISSQL mapping. Spring’s transaction management support for each of these ORM frameworks also includes JDBC.

The Web Context module builds on top of the Application Context module to provide a context that is appropriate for Web applications. In addition , this module also provides some service-oriented support. For example: implement multipart requests for file uploads. It also provides integration between Spring and other Web frameworks such as Struts and WebWork.

Spring provides a fully featured MVC framework for building Web applications. While Spring can easily integrate with other MVC frameworks such as Struts, Spring’s MVC framework provides complete separation of control logic and business objects using IoC.

UserService interfaces

UserService implementation classes