Spring Boot Basics

Spring Framework is a most widely used framework nowadays because of the features that Spring framework provides. You might be thinking when we have Spring Framework available with so many features, then why do we need Spring Boot Framework ? What are the additional features that Spring Boot provides ? What is the benefit of using Spring Boot framework ? Yes, these are very obvious questions that anybody can ask. Let’s get answers to your questions in this tutorial on Spring Boot Basics.

What is Spring Boot ?

Spring Boot is a solution from Spring team for creating stand-alone, production-grade Spring-based Applications that you can “just run”. Spring Boot helps to build Spring based applications quickly and easily. The main goal of Spring Boot is to quickly create Spring based applications without requiring the developers to write the same boilerplate configuration again and again. Spring Boot is designed to simplify the bootstrapping and development of a new Spring application. Spring Boot favors convention over configuration design paradigm and is designed to get a Spring application up and running with very little configuration.

It has its own conventions and takes an opinionated approach to configuration. It simplifies the process for configuring as well as deploying the spring applications. This framework has not been implemented from scratch by Spring Team, instead, it has been implemented on top of existing Spring Framework.

Why Spring Boot ?

  • Provides Convention over Configuration with “Opinionated Defaults Configuration” approach.
  • No need to write multiple boilerplate code, no requirement for XML configuration ultimately enhancing productivity while reducing lots of development time.
  • Creates stand-alone Spring applications, easier to launch from a container. Each service can be in its own container
  • Easy to configure and deploy completely from a script.

What Spring Boot isn’t ?

  • Spring Boot is not an application server. It’s the embedded servlet container that provides application server functionality, not Spring Boot itself.
  • Spring Boot doesn’t implement any enterprise Java specifications such as JPA or JMS. It does support several enterprise Java specifications, but it does so by automatically configuring beans in Spring that support those features.

Spring Boot Features:

1) SpringBoot starters

SpringBoot offers many starter modules to get started quickly with many of the commonly used technologies like SpringMVC, JPA, MongoDB, Spring Batch, SpringSecurity, Solr, ElasticSearch etc. These starters are pre-configured with the most commonly used library dependencies so that we don’t have to search for the compatible library versions and configure them manually.
For ex: spring-boot-starter-data-jpa starter module includes all the dependencies required to use Spring Data JPA along with Hibernate library dependencies as Hibernate is the most commonly used JPA implementation.

2) SpringBoot AutoConfiguration

SpringBoot addresses the “Spring applications needs complex configuration” problem by eliminating the need to manually configuring the boilerplate configuration by using AutoConfiguration.

3) Spring Boot Actuator

Spring Boot Actuator is a sub-project of Spring Boot. It adds several production grade services such as health, metrics, loggers, beans etc. to your application.

4) SpringApplication

The SpringApplication class provides a convenient way to bootstrap a spring application that will be started from a main method.

5) Web Development

Spring Boot can be used for web application development. Using spring-boot-starter-web module, we can start and run applications easily.

6) Properties Files

Spring Boot provides rich set of Application Properties. We can use these in properties file of project.

7) Logging

Spring Boot uses Common logging for all internal logging. Logging dependencies are managed by default.

Advantages of Spring Boot:

  • Provides Embedded HTTP servers like Tomcat, Jetty etc.
  • No need of creating boilerplate configuration and writing boilerplate code
  • Plenty of SpringBoot Starter to quickly get up and running
  • Provides Command Line Interface (CLI) tool for developing and testing Spring Boot.
    Provides number of plugins for developing and testing Spring Boot Applications easily using build tools like Maven, Gradle etc.
  • Provides number of plugins for working with embedded and in-memory databases easily.
  • Easy to develop Spring Based applications with Java or Groovy.
  • Easy to integrate Spring Boot Application with its Spring Ecosystem like Spring Security, Sprin JDBC, Spring Data, Spring ORM etc.
  • Easy customization of application properties

 

Related posts

Leave a Comment