Leap

Computer Science. Technology. Impression

Behind the magic curtains: Spring Boot

When we enjoy benefits of a system, without knowledge on how it works, we will naturally have desire to explore. Behind the magic curtains is a series of writings about such systems. This post is the first of this series. Below described is my experience while trying to understand Spring Framework, projects built on Spring Framework and one of those projects: Spring Boot.


Spring Framework

After realizing that the Spring ecosystem is very big and my experience with it considerably low. I wanted to try to understand at least the basic idea on how Spring components are organized and used — at high level.

Now we will follow the answers to the below questions:

Why Spring Framework?

Whenever we observe boilerplate code, we extract that out and invoke that from wherever we want that functionality. If that piece of code is boilerplate code for most of the developers, then it will be part of a library or a framework. And you need to be thorough with the guidelines for an effective and proper use of a framework or a library.

Spring Framework is required because it provides lot of boilerplate code. Going through below videos will help in figuring out what boilerplate code it provides.

All other features of the framework are described in a lengthy reference manual. But that’ll be very useful.

What is Spring Framework and What are its components?

Spring Framework project is foundation for all other Spring projects. Overview of the Spring Framework was very helpful to uncover some parts of the gray area. There the anatomy of the framework is described.

Spring Framework contains modules such as spring-core, spring-beans, spring-context and many others. To know more related to the modules, check Source Code of Spring Framework. Have a glance at build scripts of those modules, to figure out how those modules make up the framework.

What is the minimal Spring Framework I can use?

The recommended minimal Spring Framework to use is spring-context. Find out features of and how-to-use the framework here.

What are the projects built on Spring Framework?

You can find them in Spring Projects Page.

Bookmarks


SpringBoot

It is one of the Spring projects built on Spring Framework. Find more here at Spring Boot project page.

We generally need to configure the framework with one of these configuration methods available — xml, java configuration and annotation based.

Now, SpringBoot will (conditionally)configure our application context by convention unless we come up with our own configuration. Allowing us to get started with the application quickly. It will check your classpath for module/project you want to use in your application and configures that for you.

It also provides many features other than configuring like — embedded servlet container — to create standalone application. The way it works is so cool and easy to understand. It uses Java based configuration to configure the framework.

Demystifying SpringBoot Magic and Zero Effort Spring will demonstrate how SpringBoot does all the magic.

Bookmarks

Videos


Annotations

Java’s annotations also seemed interesting for me after doing all this Spring stuff. Just keep an annotation on an element and that’s it, you will see the element being affected as promised by the annotation.

I was curious to know how those annotations work on our piece of code. And the concept seemed a bit weird and unusual. Providing our own annotation is not so simple. But annotations are handy.

Annotation Processing gives some insights on annotations. In Python we have a similar language construct called decorator.

Bookmarks