Home Spring Spring Core Spring Core Tutorial

Spring Core Tutorial

Spring core framework has become a default standard in building any enterprise-level Java application. In this spring tutorial, we will learn the core concepts of the spring framework and how to use it to build an application with a real-life web application.

Spring is a lightweight application development framework used for building Enterprise level Java application. It is an open-source framework developed by Rod Johnson in 2003. This framework provides many features in terms of simplicity, testability, and loose coupling. Spring mostly empowers Plain Old Java Objects (POJO) which is referred to as beans to achieve things that were previously only possible with Enterprise Java Beans (EJBs).

Spring Framework Advantages

One of the main advantages of Spring is, it is lightweight and minimally invasive. When I say invasive, it means Spring tries to avoid littering your application with its own APIs. You may have to annotate one of the Spring annotations, but its mostly you own POJO.

Spring also offers loose coupling of components within the application such that object just states their dependency instead of creating and looking for dependent objects. It is the responsibility of spring to provide dependent objects to each component. Spring also allows developers to focus on only the core logic of application by taking care of boilerplate configurations and code.

In the last few years, spring’s popularity is booming. A lot many enterprise-level projects are using the spring framework as their core framework. Important to mention many other spring projects are using this framework as a foundation to provide additional functionalities to developers for quick development.

spring-architecture

Spring Framework is built by combining various modules. Each module has its own functionality. There are around 20 modules as such which are grouped into different heads like – Core Container, AOP, Web, Test, etc.

These modules give you everything you need to develop an enterprise-ready application. Having said that, you don’t require to base your application completely in Spring. You have the liberty to choose whichever module which fits your need.

Let’s look into these spring modules one at a time and understand what they do.

Spring Core Container

The heart of spring is a container that manages how the beans in an application are created, configured, managed, and destroyed. These modules provide the fundamental parts of the framework. It comprises of BeanFactory and Application Context which provides the Inversion of Control (IOC) and Dependency Injection (DI) feature. All of the spring modules are built on top of the core container.

Spring’s AOP Module

With Aspect-Oriented Programming (AOP), application-wide concerns like logging, authentication, security, etc. are decoupled from the objects to which they are applied. With AOP, you define the common functionality in one place, and you can declaratively define how and where this functionality is applied without having to modify the class to which you’re applying the new feature.

Data Access and Integration

When you work with JDBC, it results in a lot of boilerplate code lingering around in your application like getting a connection, creating a statement, processing a result set, and then closing a connection. This module abstracts these boilerplate codes so that your database code is clean and simple and you can focus only on the core logic.

Web and Remoting

Model-View-Controller (MVC) paradigm is an accepted approach to build any web application so that the user interface is separate from the core application logic. Spring provides a feature to build an MVC application with less hassle. Do not worry too much about it if this is too overwhelming. We will discuss Spring Boot in the future which is a simplified project offered by Spring to build web applications quickly.

Testing

As a Java developer, we know how important is to test our individual code. Spring understands this importance and provides a dedicated module to test spring applications. There are collections of mock implementations for writing unit tests against the code that works with databases, REST calls, servlets, etc. Throughout this spring tutorial, many of the examples will be driven by tests and utilizing the testing facilities offered by spring.

This was just a brief summary of what the spring framework has to offer. We will be covering a lot more going forward in this spring tutorial. We will be learning how to build a real-life application using spring and other components. But before we go into that it is important for us to understand the core concepts of spring. So please stay with me. I am sure by the end of this spring tutorial you will start connecting the dots and become the next expert in build application using spring framework.

lifeinhurryhttp://lifeinhurry.com
lifeinhurry.com is a digital platform to explain about various topics on finance, career, programming and lifestyle and writes in hope and passion that one person will be better because he or she reads what we wrote.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Spring Bean Scope

What is the Spring Bean Scope? The Spring Framework is responsible for creating and managing beans in its container. It is also...

Resolve Ambiguity in Spring Beans

So far in this series, we have learned how we can leverage auto-configuration to enable Spring to create beans and wire them...

Spring Core | Bean & Wiring | Part-2

In our previous post, we learned how we can create beans automatically by using @Component and wire them with other objects using...

Spring Core | Bean & Wiring | Part-1

Just imagine your favorite dish, it takes how many ingredients to pull together a dish which waters your mouth. These ingredients compliment...