Por favor inicia sesión para publicar comentario

What is Spring Framework?

  • Amruta Bhaskar
  • May 25, 2021
  • 0 comentario (s)
  • 430 Puntos de vista

Spring Framework is an open-source framework for building web applications with Java as a programming language. It is powerful and lightweight yet easy to use, and it provides support for developing Java applications easily. Spring is a lightweight framework which can be thought of as a framework of frameworks because it also offers support for various frameworks such as hibernate, struts, tapestry, and JSF.

The Spring web MVC framework offers model-view-controller architecture offers components which helps you to be flexible and loosely coupled web applications.

The MVC pattern allows you to separate different aspects of the application while offering loose coupling between these elements. Spring MVC also helps you to build flexible and loosely coupled web applications.

The MVC design also allows you to separate business logic, presentation logic, and navigation logic. It also offers an elegant solution to use MVC in Spring Framework with the help of DispatcherServlet.

Spring MVC Test is a testing framework which provides support for testing Spring MVC controllers. When we want to write unit or integration tests which use the Spring MVC Test framework, we have to know that:

  • We can write our tests by using JUnit 4, JUnit 5, or TestNG. We can also use other testing frameworks as long as the testing framework provides support for the Spring MVC Test framework or we use the standalone configuration.
  • Because the Spring MVC Test framework is built on the top of the Servlet API mock objects provided by the spring-test module, it doesn’t require a servlet container.
  • It uses the DispatcherServlet class that provides full support for the Spring MVC runtime behavior.
  • We can configure the system under test by using the standalone configuration or the web application context based configuration

Spring enables you to build applications from “plain old Java objects” (POJOs) and to apply enterprise services non-invasively to POJOs. This capability applies to the Java SE programming model and to full and partial Java EE.

Examples of how you, as an application developer, can use the Spring platform advantage:

  • Make a Java method execute in a database transaction without having to deal with transaction APIs.
  • Make a local Java method a remote procedure without having to deal with remote APIs.
  • Make a local Java method a management operation without having to deal with JMX APIs.
  • Make a local Java method a message handler without having to deal with JMS APIs.

Spring Framework Architecture

The Spring Framework Architecture provides 20 modules which can be used based on an application requirement.

The Core and Bean provide the fundamental part of the framework, including IoC and DI.

Core Container

The Core Container is further divided by subcomponents like Core, Beans, Context, and Expression Language modules.

Spring Core:

The Core module provides all the primary component of the spring framework. It includes IoC (Inversion of Control) and Dependency Injection features.

Spring Bean:

This module offers BeanFactory, which is a sophisticated implementation of the factory pattern.

Spring Context:

The Context module builds on the solid base provided by the Core and Beans modules, and it is a medium which helps you to access any objects defined and configured.

Spring Expression Languages (SpEL):

This module offers expression language for modifying and querying object graph during the runtime.

Data Access/Integration:

The Data Access and Integration layer consist of the JDBC, ORM, JDBC, OXM, JMS, and Transaction modules.

  • ORM: ORM module offers consistency/ portability to code irrespective of data access technologies. It will be based on object-oriented mapping concept.
  • The JDBC module consists of a JDBC-abstraction layer. It helps you elements the need to perform JDBC related coding.
  • OXM: Object XML Mappers (OCM) helps you to convert the objects into XML format and vice versa.
  • The Java Messaging Service module offers features like producing and consuming messages.
  • Transaction: This module offers declarative and programmatic management method for implementing unique interfaces and for all types of POJOs (Plain Old Java Object. The Spring Framework Architecture provides 20 modules which can be used based on an application requirement.

Spring Web:

Web: This module uses servlet listeners and a web-oriented application context. It also offers a feature of web-oriented integration and functionality for multi-part file upload.

Web-servlet: This module stores MVC based implementation for web applications.

Web-Socket: Module offers WebSocket based and two-way communication between the client and the server in web apps.

Web-Portlet: This module is also called Spring-MVC-Portlet module. It offers for Spring-based Portlets and copies all the functionality of a Web-Servlet module.

AOP: AOP language is a useful tool which allows developers to add enterprise functionality to the application.

Instrumentation: This module offers class instrumentation and loader implementations. It is used for specific application servers.

Test: This module provides support for testing of Spring components with TestNG or JUnit tools. It offers consistent loading of Spring ApplicationContexts and caching of those contexts.

Por favor inicia sesión para publicar comentario

( 0 ) comentario (s)