Introduction to Spring Framework

Nikasakana
4 min readOct 24, 2020

--

Photo by Maximilian Weisbecker on Unsplash

Hi, If you are reading this article I have couple of assumptions to share:

either you saw the article’s link on my timeline since we are friends on some social media, and for the sake of friendship are reading this, or it means that you have heard of this mysterious buzzword called “Spring Framework” and want to know this generous framework better.

What is a Framework?

Let’s first make the meaning of a framework a bit more clear.

Today whenever a project is built using Java or any other language, core functionality needs to be constructed from scratch. Yet many useful functionalities have already been built and are freely available in the open source world we are living in. This freely available code developed by someone else and shipped as a *.jar is called a library. The beauty of libraries is that whenever you add it as a dependency, all classes in it become easily accessible for your own use.

As more and more code/functionality is added , libraries can get quite big and unmaintainable/inefficient as a monolith(One big piece of unit code/project). So the contents of this bloated jar can be split and organized into separate jars — each with a functionality focused on a certain topic. This is the exact moment project leaves the scope of libraries’ and enters a more interesting world, “World of Frameworks”.

framework is just a family of split/decomposed libraries or functionalities that can me used together in more than one way” — unknown.

What is Spring Framework

“ Spring is currently the VIP of Java frameworks ” — unknown

As you already guessed by name, well it’s a framework, an open source framework that has all the sub components/libraries in it to make a robust enterprise application on the go, and well it is developed using Java :). If someone today tells you to write some server side application using java, i suggest, without thinking twice, going to Spring webpage and start learning it, since it has all the, possibly, needed components in it, from Data Access Layer to Web layer.

One key feature, apart from all known features specified above, we must underline about Spring Framework is that, it serves as an “ Inversion of control “ / “dependency injection container ”.

What the heck is an “Inversion of control” / ”dependency injection container” you may ask. Well the details of this topic is beyond the scope of this article but internet is full of resources about dependency injection( my upcoming article is all about it ). but in couple of words Inversion of Control is a principle in software engineering by which the control ( creation, destruction, injection, invocations … etc ) of objects, or portions of a program, is transferred to a container or a framework.

So basically when using Spring in your project/code, there is this other dude called “dependency injection container” with you, who will act as you tell (configure) it to act and instantiate/give you all the objects you ask him/her for. Since someone else is managing objects for you, swapping between different objects will become as easy as just asking container for other object and it comes in very handy during enterprise development.

it makes connecting and disconnecting objects easy by providing comprehensive infrastructure for assembling objects. Using Spring to develop a Java application is like building a lightly connected Lego castle; each object is a Lego piece that you can easily remove and replace with a different one” — unknown

Spring Framework Components

Now, before we end this article let’s make a brief, visual introduction to all the main building blocks of a Spring Framework, that are “must know”-s and which we will try to cover in the future articles. Hope this picture will make you intrigued and you’ll google some of them :).

Core Container is the “dependency injection container” one that we talked about.

As you can see from the image( From official Spring website ), spring, with it’s all different components, is much more then a dependency injection container and has a very wide range of usability.

What to expect

If you have come this far in the article, at first i want to thank you for following till the end. Secondly i want to mention, that this was first, introductory, article in the series of articles about Spring Framework. I am still in the process of learning Spring Framework too so let’s grow together in this topic.

Upcoming articles will be about all the details and inner workings of spring framework.

--

--

Nikasakana
Nikasakana

Written by Nikasakana

Writing about tech and other findings

No responses yet