Spring Overview

  • Facebook
  • Google
  • LinkedIn
  • Twitter

The Spring framework, created by Rod Johnson, is an extremely powerful Inversion of control framework to help decouple your project components dependencies. Spring is lightweight when it comes to size and transparency. The basic version of spring framework is around 2MB. The core features of the Spring Framework can be used in developing any Java application, but there are extensions for building web applications on top of the Java EE platform. Spring framework targets to make J2EE development easier to use and promote good programming practice by enabling a POJO-based programming model.

Advantages of Spring Framework:
  • Spring enables developers to develop enterprise-class applications using POJOs. The benefit of using only POJOs is that you do not need an EJB container product such as an application server but you have the option of using only a robust servlet container such as Tomcat or some commercial product.

  • It truly makes use of some of the existing technologies like several ORM frameworks, logging frameworks, JEE, Quartz and JDK timers, other view technologies.

  • Testing an application written with Spring is simple because environment-dependent code is moved into this framework. Furthermore, by using JavaBean-style POJOs, it becomes easier to use dependency injection for injecting test data.

  • Spring`s web framework is a well-designed web MVC framework, which provides a great alternative to web frameworks such as Struts or other over engineered or less popular web frameworks.

  • Spring provides a convenient API to translate technology-specific exceptions (thrown by JDBC, Hibernate, or JDO, for example) into consistent, unchecked exceptions.

  • Lightweight IoC containers tend to be lightweight, especially when compared to EJB containers, for example. This is beneficial for developing and deploying applications on computers with limited memory and CPU resources.

  • Spring provides a consistent transaction management interface that can scale down to a local transaction (using a single database, for example) and scale up to global transactions (using JTA, for example).

Spring Framework Architecture

Spring is well-organized architecture consisting of seven modules. Modules in the Spring framework are:

Spring Architecture

Spring Core: The Core package is the most import component of the Spring Framework. This component provides the Dependency Injection features. The BeanFactory provides a factory pattern which separates the dependencies like initialization, creation and access of the objects from your actual program logic.

Spring AOP: AOP is one of the key components of Spring framework. AOP is used in Spring:

  • Provide declarative enterprise services, especially as a replacement for EJB declarative services. The most important such service is declarative transaction management, which builds on Spring's transaction abstraction.
  • Allow users to implement custom aspects, complementing their use of OOP with AOP

Spring ORM: The ORM package is related to the database access and provides integration layers for popular object-relational mapping APIs, including JDO, Hibernate and iBatis.

Spring Web: The Spring Web module is part of Spring’s web application development stack, which includes Spring MVC. The Web context module builds on top of the application context module, providing contexts for Web-based applications. Spring framework supports integration with Jakarta Struts, JSF and webworks. The Web module also eases the tasks of handling multipart requests and binding request parameters to domain objects.

Spring DAO: The DAO (Data Access Object) support in Spring is primarily for standardizing the data access work using the technologies like JDBC, Hibernate or JDO. The Spring's JDBC and DAO abstraction layer offers a meaningful exception hierarchy for managing the database connection, exception handling and error messages thrown by different database vendors. The exception hierarchy simplifies error handling and greatly reduces the amount of code that we need to write, such as opening and closing connections. This module also provides transaction management services for objects in a spring application.

Spring Context: This package builds on the beans package to add support for message sources and for the Observer design pattern, and the ability for application objects to obtain resources using a consistent API. Spring context is a configuration file that provides context information to the Spring framework . The Spring context supplies enterprise services such as JNDI access, EJB integration, e-mail, internalization, validation, and scheduling functionality.

Spring Web MVC: This is the Module which provides the MVC implementations for the web applications. MVC framework is a full-featured MVC implementation for building Web applications and highly configurable via strategy interfaces and accommodates numerous view technologies including JSP, Velocity, Tiles and the generation of PDF and Excel Files.

      Advertisements