Spring vs Spring Core vs Spring Boot

Spring is robust and lightweight framework us to develop enterprise applications. Spring is an open source Java platform developed by Rod Johnson in 2003.

Spring makes it very easy to develop Java Enterprise application.

Spring is supported by all JDK 8+ versions. It provides out of the box support to JDK 11.

According to java official documentation, “Spring” means different things in different contexts

We can easily create Spring project using https://start.spring.io/. This website will help us to create Restful web services.

There is one more open source editor named as Spring too kit is there in market to build Spring applications.

Below are the various modules supported by Spring framework:

Spring Core: It is main feature dependency injection and inversion of control of Spring core framework.

Dependency Injection is a main feature of Spring core framework. This provides a dependency

Let’s try to understand about dependency injection and inversion of control. For example, We have two classes as Class A and Class B.

Dependency injection will come in picture if we want to make a relation or inject Class A in to Class B. Dependency injection can be achieved using parameterized constructor and getter setter methods. This complete process of injection called as IoC (Inversion of Control).

Spring AOP: Aspect Oriented Programming (AOP) is one of the key feature of Spring framework. AOP breaks down complete code into multiple modules.

AOP is similar to OOPS concept where it breaks code into multiple reusable modules. AOP provides the capability to dynamically add module at runtime.

Spring Web MVC (Model View Controller): Spring web is all about MVC architecture. It also allows us to create flexible and loosely coupled web application.

Spring DAO (Java Data Objects): It provides an interface which provides us the capability to connect with Spring MVC.

Spring ORM (Object relational mapping): ORM is responsible to access and manipulate data using some framework such as Java Persistence API (JPA), Java Data Objects (JDO), iBATIS SQL Maps, etc.

Spring context: Spring context is a IoC containers. It instantiates, configures, and assembles beans or pojo classes by reading XML configurations, Java annotations, and/or Java code in the configuration files.

Now, the question is: why is Spring Framework famous?

Spring offers other modules such as Spring Core, Security, MVC, Spring Boot, and Logging, which is very easy to integrate, loosely coupled, easy to test and helps us to develop an application with lot more features in less time.

We can test the Spring Framework using Junit.

The Spring Framework has a big community.

Just for future reference

Spring framework all together is having three different flavors known as Spring core, Spring MVC and Spring Boot. Soring MVC uses Spring core and Spring boot uses Spring MVC which internally uses Spring Core.

Lets talk about more on Spring MVC and Spring boot:

Spring MVC

Spring web is all about MVC architecture. It also allows us to create flexible and loosely coupled web application.

It is a very well known design pattern to develop web application where we divide complete application in to three sub parts known as Model, View and Controller.

Model → This is responsible for maintaining data. e.g. bean or Pojo class.

View → It is a representation of the end result to output or show on the on the page. e.g. JSP, HTML etc.

Controller → Controller is a backend code which gets trigger on performing any action or user input.

The browser will call the controller as shown in the below inline diagram. The controller will decide whether to call view or model.

1st Scenario → The browser will call the controller and, depending on input data, the model will call the database as it is tightly coupled using JPA or Hibernate. On getting a response back from the database, the model will call view to output data on the browser output screen.

2nd Scenario → The browser will call the controller and, depending on the input data, the view will call the database as it is tightly coupled using JPA or Hibernate. On getting a response back from the database, the view will output data on the browser output screen.

Mode can get request to return data from both View and Controller.

Spring Boot

Spring Boot is a extended version of Spring framework which provides a capability to develop a project with more feature in less time.

There are multiple things Spring Boot project provides.

  1. Spring Boot initializer which help us to create a project in less than 10 min.
  2. Spring Boot starter projects helps us to define all dependencies for our projects.
  3. Spring Boot DevTools helps us to deploy Spring Boot application without server restart.

Spring Boot follows a layered architecture where each layer communicate with other required layer. There are four layers in Spring boot:

  • Presentation Layer: This layer use to present JSON on front end and authenticate end users.
  • Business Layer: This layer is all about writing business logic and things related to authorization and authentication.
  • Integration Layer: This layer is responsible for storage logic and convert business objects from and to database rows.
  • Data Layer: As name suggest it is related to data and perform operation such as CRUD (create, retrieve, update, delete).

Imran Khan, Adobe Community Advisor, AEM certified developer and Java Geek, is an experienced AEM developer with over 11 years of expertise in designing and implementing robust web applications. He leverages Adobe Experience Manager, Analytics, and Target to create dynamic digital experiences. Imran possesses extensive expertise in J2EE, Sightly, Struts 2.0, Spring, Hibernate, JPA, React, HTML, jQuery, and JavaScript.

0