What is Spring?

What is Spring?

Spring has been created by Rob Johnson in 2003. Spring is an application development framework for Java. Spring framework is an open-source platform. Spring makes Java easy, safe and quick. Spring gives more functionality to developers. Spring has a lot of modules. Spring Boot, Spring Security, Spring MVC, Spring Cloud, Spring RestAPI, and Spring AOP are the most known modules. This module is usually used for enterprise-level applications. With Spring we can make microservices. Spring's core language is Java. With Spring we can make RestFul API for any technology which supports the network.

Core container modules are the most essential feature like Inversion of Control(IoC) and Dependency Injection (DI). What is Bean? Each object which we have created (like User model, Item model) for our Spring application is Bean. We can write beans to XML or java files. In Java files to define a class as a bean, we should add @Bean annotation before declaring the class:

@Bean
public class User{
    String name;
    int age;
}

When Spring read @Bean annotation it will add the class as a bean to the IoC container. And with the IoC container, we give all operations to Spring like create beans, define the bean's lifecycle, lifetimes and dependencies between objects.

DI (Dependency Injection) is expressed as removing dependencies. Spring made dependencies between objects automatically via XML configuration.

Spring MVC: One of the modules of the Web layer of the Spring Framework is the Web-Servlet module. This module consists of Spring Framework’s MVC (model-view-controller) implementation for web applications. It provides model-view-controller architecture and ready elements that can be utilized to build loosely coupled and flexible web applications. The model-view-controller pattern results in dissociating the various aspects of the application such as UI logic, business logic, input logic while offering a loose coupling between these components. Spring MVC is designed around a DispatcherServlet that deals with HTTP requests and responses.

Data Access/Integration: This layer contains the JDBC, ORM, OXM, JMS and Transaction modules. These modules simply allow interacting with the database.

Spring AOP(Aspect Oriented Programming): Another important feature of Spring, it provides code management at application runtime. For example, when a record will be made to the database, it can be managed with the entitymanager and the notations to be begin and committed.