Spring Framework - Overview

    0 Votes

Spring framework is developed by Rod Johnson. Spring Framework is a Java platform which provides a very rich architecture by which developer can build complex Java application with ease. The reason behind the success of Spring framework is

  • It provides such infrastructure by which developer has to write less code, need to focus only on business logic without worrying about other tasks like Logging, Transaction, Security etc., 
  • Spring does not reinvent the Wheel but it has provision to hook with any UI layer, business, DAO use popular technologies. Spring can be considered as a store where everything is available. It works on Spoke and Hub technology where Spring act as Hub and every popular technology like Hibernate, Struts, JSF, JMS, etc. act as Spokes. 
Spring - Spoke and Hub
Spring Framework

 

Why Spring?

Spring has been developed to ease the Enterprise application development. To understand why we choose Spring over normal Java EE Stack, let us compare Spring and Java EE.

Spring advantages(Spring benefits and Java EE pain points)

  • Spring is very light weight. It can run on any server and the size of Spring is also very small.
  • One of the pain points of Java EE stack is that when we use EJB it needs an Application server (Jboss,Weblogic etc.) which has EJB container to deploy artifacts. It can't run on Web servers like Tomcat due to the absence of EJB container. But, Spring does not need any application server. It can run on a web-server, moreover we can run it on a standalone mode too.
  • Another pain point of Java EE stack is that the developer has to implement many Java stack specific interfaces or abstract class. For example, to create a servlet one has to extends HTTPServlet class. Application has strong coupling with Java EE so to remove Java EE from a project or introduce Java EE in a new Project is not an easy task to do. It needs a lot of refactoring. To introduce Spring, no Spring-specific interface or abstract class is required. We need to use some annotations in case of Spring. Believe me, those are very few and we work only with POJOs (Plain Old Java Object). To remove or introduce Spring in a project is very easy.
  • Spring container uses Dependency Injection (DI) to takes care of HAS-A or dependencies part. So Developer only bother about their business logic not the collaboration between Objects. But in Java EE, developer has to take care of the collaboration.
  • Spring incorporate Separation of Concerns principle very well. The cross-cutting concerns like Logging, transaction, security which are not avoidable while coding but they are not core business logic. In Spring those are taken care of by AOP (Aspect Oriented Programming) and developer only implements business logic. In Java EE we do not have such provision.
  • Spring uses Template pattern to suppress the boilerplate code and take the responsibility to call resource reclamation task (close costly resources like connection). In Java EE developer has to write those code like loading database driver, getting a connection, closing connection etc.
  • As Spring provide templates for popular technologies, it is very easy to incorporate any popular technology in your project.

Due to above benefits, most of the projects default choice is Spring.

Popular Videos

How to speak to people

How to speak so that people want to listen.

Got a tip or Question?
Let us know

Related Articles

Spring Architecture
Step by step guide for Spring configuration
Building First Spring application
Spring Bean XML File
Spring Container
Spring Bean - Learn with an Example
Spring Bean Scope
Spring Bean Life Cycle
Spring Bean Post Processor
Spring Inner Bean
Spring Autowiring
Spring Autowiring Types
Spring Qualifier with Autowiring
Spring Collection Injection
Spring Inheritance
Spring Event Handling
Dependency Injection
Spring AOP
Spring AOP Example