- What is Spring Framework?
- Why we need Spring Framework?
- When do we use Spring Framework?
- How do we implement Spring Framework?
Spring is a dependency Injection Framework. The next question comes in mind. What is Dependency Injection? This leads to next question, What is Dependency?
Let’s take an example of an application using 3-layered architecture.
If Business layer need some data, it calls some class which is present inside the data layer. So, here business layer is dependent on the data layer. Similarly, if we want to show some data to the user or save some data entered by the user, web layer needs to talk to business layer. This is nothing but, web layer is dependent on some class which is present inside the business layer.
A class which needs the service of another class to provide certain functionality, is said to be dependent on other class.[this is just that, what are all things or classes it need to perform its own functionality.]
Spring Framework – create/instantiates the objects and populate the dependencies.
It is your job as a programmer to tell Spring Framework, what are the objects it would need to manage and what are the dependencies of each class.
Spring Framework was created by Rod Johnson in the year 2003.
One of the important things about Spring Framework is that, it’s not one big Framework. It’s not like you have to use the entire Framework or you don’t use it at all. It’s not one big JAR file present. Lot of smaller JAR files, each for different purpose.
Spring is built in a very modular way and this enables you to use specific modules without using other modules of the Spring Framework.
Spring Modules have the same release version as the Spring Framework.
Spring Projects provide solutions for different problems faced by enterprise applications. Like, Spring Batch, Spring Security, Spring Boot, Spring Cloud, etc.
- Spring is a complete and a modular framework, I mean spring framework can be used for all layer implementations for a real time application(multi-layered architecture) or spring can be used for the development of particular layer of a real time application unlike struts [ only for front end related ] and hibernate [ only for database related ], but with spring we can develop all layers.
UI Layer –> Struts/JSF Integration, Spring MVC
Service/Business Layer –> Spring REST, Spring Security, Transaction Mgmt
DB Layer –> Spring Data [ Spring JDBC, Spring ORM]
- Spring framework is said to be a non-invasive means it doesn’t force a programmer to extend or implement their classes from any predefined class or interface given by Spring API.
- Spring is light weight framework because of its POJO model.
It was created :
- to enhance developer productivity
- to enforce some of the industry’s well-known best coding practices.
Spring Framework is free and open source, which is now maintained by Pivotal.
Loose Coupling :
In spring objects are loosely coupled, this is the core concept of spring framework we will see in depth about this loose coupling and how its differ from tight coupling later.
The core of Spring Framework is the ‘Inversion of Control’ container or IoC container.
IoC container provides :
- consistent means of configuring and managing Java objects.
- IoC container is responsible for managing these objects life cycle.
- Creating those objects
- Calling their initialization methods
- Configuring these objects by wiring them together.
Over the years, Spring framework grown so much that it is no more just an IoC container. Now, it includes several modules and projects.

- Dependency Injection
- Aspect Oriented Programming(AOP) – for implementing cross-cutting concerns.
- Data Access – Spring Data : Spring JDBC, Spring ORM, etc
- Security and authorization – Spring Security
- Spring MVC
- Spring REST
- Spring Boot
- Spring Cloud, etc
Spring version 4.3, is fully compatible with Java 8.
Spring comes with a great deal of default behavior already implemented. Components called “infrastructure beans” have a default configuration that can be used or easily customized to fit the project’s requirements.
Spring is built on the principle “Convention over Configuration”.
Spring official Javadoc: http://docs.spring.io/spring/docs/current/javadoc-api/
Spring Reference: http://docs.spring.io/spring/docs/current/spring-framework-reference/
Stay connected with Spring :
Twitter : twitter.com/springcentral
Youtube : spring.io/video
Questions : http://spring.io/questions
JIRA : jira.spring.io