Introduction to Spring Framework

  1. The Spring Framework is lightweight application framework and one of the widely used Java EE framework and it was developed by Rod Johnson in 2003.

  2. It provides support to various frameworks as Struts, Hibernate, EJB etc and provides a lot of implementations of web objects like REST, an MVC web framework and more.

  3. The main concepts in the Spring framework are
    • Dependency Injection or Inversion of Control
    • Aspect Oriented Programming

  4. Dependency injection allows to write different components in loosly coupled manner by reducing direct or hard-coded dependencies between different components of the application, These different loosly coupled components are independent of each others. To create a loosely coupled, extendable and maintainable application the spring container has the capability to wire these components in effective manner. Dependency injection allows us to move the dependency resolution from compile-time to runtime. Some of the advantages of using Dependency Injection
    • Boilerplate Code reduction
    • Division of Concerns
    • Configurable components
    • simple unit testing
    Spring Framework’s dependency Injection feature and its support to various frameworks makes the simple and effective development of JavaEE application.

  5. Loose-coupling between Objects dependencies and dynamic binding of the objects at runtime are achieved by Inversion of Control (IoC) mechanism.The spring IoC container is responsible for injecting

  6. Spring framework doesn't require server while the Struts or EJB application require server to run the application

  7. Spring framework has predefined templates and reduces the amount of boiler-plate code, such as initializing objects, open/close resources. Spring framework provides some predefined templates for JDBC ,Hibernate..etc For example Lets see the use of JdbcTemplate , JdbcTemplate class helps us to remove all the JDBC programming boiler-plate code like the code for committing transaction ,creating connection ,create statement exception handling,closing connection etc.

  8. AOP exclude the direct dependency of cross-cutting tasks such as logging, transaction management, data validation, authentication.

  9. For keeping our application lightweight, Spring framework is divided into several modules. The Spring framework comprises several modules such as
    • Spring AOP is used for aspect oriented programming.
    • Spring Context is used for dependency injection.
    • Spring DAO is used for database operations using DAO pattern.
    • Spring ORM is used for ORM tools support such as Hibernate.
    • Spring JDBC is used for JDBC and DataSource support.
    • Spring Web Module is used creating web applications.
    • Spring MVC is used Model-View-Controller implementation for creating web applications, web services etc.


Copyright 2016 ©