Sunday, May 13, 2018

Spring boot vs Spring framework

Before Spring boot, of course I was working with the Spring framework and was somewhat reluctant to move from Spring to Spring boot. However, by considering
benefits provided by Spring boot, I did not need much persuation to move to Spring boot. So what is Spring boot? How do you differenciate Spring boot from Spring?

Spring boot, unlike the Spring framework, provides the developer a KICK START to your developemt project. How's that sound? Pretty neat ha? Indeed!!!

The key behind this, is the auto configuration and starter projects provided by Spring boot.

Spring boot checks for the librabies provided in the class path (i.e: provided as a maven dependency) and configure it for you based on the predefined
configuration. With this, you can avoid the tedious configuration tasks. i.e: If you are to use hibernate, jdbc or jpa, you'll need to configure data sources.
Having JPA dependencies in the class path, Spring boot will do the auto configuration for you.

However, Spring boot give you the liberty of overriding predefined configuration. (I will discuss this in a later post, hopefully soon :)).

Secondly, the starter projects. What if I say to you, you only need to add one maven dependency for your project, and it will manage
most of the dependencies and there versions for you? Spring boot documentation refers to starter projects as dependency descriptors. This is a one-stop-shop
mechanism to manage all your dependencies(most likely used).

As an example, if you want to develop a web application, 'Spring Boot Start Web' is the starter for you.

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>
Some of the starter projects one would be interested in;

  • spring-boot-starter-data-jpa: Provide jdbc support to your project
  • spring-boot-starter-jdbc : Provide JPA support to your project
  • spring-boot-starter-cache: Provide Spring framework's caching to your project

So preceding facts convinced me to try out Spring boot. I hope it will do the same for you.

No comments:

Why should you use react JS?

Tired of choosing a proper framework to write your web application? This is a common question that most developers get stuck when the...