Introduction To Spring Boot Framework - A Quick Tutorial for Beginners


In this article, we understand the basics of Spring Boot framework. We look at the important features of Spring Boot and how it is different from the Spring framework.

You will learn

  • What is Spring Boot?
  • What are the problems in developing Spring Based Applications?
  • How does Spring Boot help in solving these problems?
  • What are important concepts to understand in Spring Boot?
  • What are the best practices in using Spring Batch?
  • What is Spring Boot Auto Configuration?
  • What are Spring Boot Starter Projects?

What Is Spring Boot?

Here’s the official definition of Spring Boot from the Spring Boot Web Site.

Spring Boot makes it easy to create stand-alone, production-ready Spring-based application that is ready to run. Most Spring Boot applications need very little Spring configuration.

What does it mean? Let’s start with looking at Spring Framework.

Spring Framework

The core feature of Spring framework is dependency injection. Spring alsoe provides great integration with other frameworks, like Hibernate. Spring provides a few frameworks of its own - for example, Spring MVC for developing web applications and REST API.

Problem with Spring Based Applications

If you look at any Spring-based application, such as a Spring MVC application:

image info

You need to configure a lot of components within it:

image info

You also end up configuring a data source and a transaction manager:

image info

The configuration story is the same for any Spring-based application.

Spring Boot To The Rescue

Spring Boot asks the question:

Why do we need to do the exact same thing for every project involving Spring?

Why not just abstract it away, and help the developer build applications quicker?

Spring Boot Auto Configuration

Spring Boot Auto Configuration looks to bring more intelligence into application configuration.

For example, it looks to build a few patterns, identify what JAR files are available, and looks to auto-configure a lot of the things.

Spring Boot ensures that a developer can build a new Spring project in a few minutes, instead of hours.

Spring Boot And Frameworks

Spring Boot takes care of the typical things you normally do in Sprint 0 of a project. In addition, Spring Boot helps the developer in the following areas:

  • Integration with several frameworks
  • Configuration management
  • Logging
  • Transaction management
  • Error/Exception handling
  • Monitoring and health checks
  • Integrating unit testing and mocking frameworks

All we need to do is provide the frameworks that are needed by the application, and Spring Boot magically auto configures them.

Spring Boot And Version Management

Spring Boot also takes the responsibility of managing versions of dependent libraries.

You just need to migrate to the latest version of Spring Boot, and the corresponding compatible versions of all the frameworks being used are directly available for you.

Why Do You Need Spring Boot?

Reducing Project Start-up Time

Spring Boot reduces the startup time in creating new projects. You can add frameworks and Spring Boot automatically configures them for you. In the world of microservices, as we create a number of smaller microservices instead of a large monolith, Spring Boot helps us start up projects quickly.

Spring Boot Provides Starter Projects

Spring Boot provides a feature called Starter Projects, which helps you quickly add specific features to your application. Important ones include:

  • spring-boot-starter-web-services: Quickly build SOAP Web Services.
  • spring-boot-starter-web: Useful to build RESTful web applications, using Spring MVC. It uses Tomcat as the default embedded container.
  • spring-boot-starter-test: Used for testing Spring Boot applications, using libraries such as JUnit, Hamcrest, and Mockito.
  • spring-boot-starter-hateoas: Useful for building hypermedia-based RESTful web applications, using Spring MVC and Spring HATEOAS.
  • spring-boot-starter-jersey: An alternative to string-boot-starter-web. Useful for building RESTful web applications using JAX-RS and Jersey
  • spring-boot-starter-security: Useful for using Spring Security
  • spring-boot-starter-jpa: Used for Spring data JPA with hibernate
  • spring-boot-starter-data-rest: A stater for exposing Spring Data repositories over REST, using Spring Data REST

Spring Boot Provides Developer Tools

Spring Boot makes the life of a developer a lot easier by providing important debug and deployment tools.

Do check out our video on the same topic:

image info

Summary

In this article, we had a quick look at the Spring Boot Framework. We saw that the Spring framework is very useful to developers, but Spring projects had a large configuration overhead. Spring Boot adds some intelligence with autoconfiguration. It greatly reduces project startup time and provides easier mechanism - called starter projects - for developing different kinds of applications.

Congratulations! You are reading an article from a series of 50+ articles on Spring, Spring Boot , Hibernate, Full Stack, Cloud and Microservices. We also have 20+ projects on our Github repository. For the complete series of 50+ articles and code examples, click here.

Join 300,000 Learners!

Learn Spring Boot in 10 Steps - FREE Course

Next Steps

Image

Image

Image Image

Image

Image

Image

Image

Image

Image

Image

Image

Image

Image

Image

Image

Related Posts

Spring Boot Tutorials for Beginners

At in28Minutes, we are creating a number of tutorials with videos, articles & courses on Spring Boot for Beginners and Experienced Developers. This resources will help you learn and gain expertise at Spring Boot.

Spring and Spring Boot Video Tutorials for Beginners

At in28Minutes, we are creating a number of tutorials with videos, articles & courses on Spring Boot for Beginners and Experienced Developers. Here's a list of video tutorials and courses for you

Software Design - Separation Of Concerns - with examples

Software architects and programmers love having Seperation of Concerns. What is it? Why is it important? Let's get started.

Object Oriented Software Design - Solid Principles - with examples

Software design is typically complex. Object oriented design takes it to the next level. There are a number of design patterns and other stuff to be aware of. Can we make things simple? What are the goals to aim for when you are doing object oriented design? SOLID Principles is a great starting point for Object Oriented Design.

Software Design - Open Closed Principle - with examples

Open Closed Principle is one of the SOLID Principles. You want your code to be easily extended. How do you achieve it with minimum fuss? Let's get started.

Software Design - What is Dependency Inversion Principle?

Dependency Inversion Principle is one of the important SOLID Principles. Dependency Inversion Principle is implemented by one of the most popular Java frameworks - Spring. What is it all about? How does it help you design good applications?

Introduction to Four Principles Of Simple Design

With agile and extreme programming, the focus is on keeping your design simple. How do you keep your design simple? How do you decide whether your code is good enough?

Software Design - Single Responsibility Principle - with examples

For me, Single Responsibility Principle is the most important design principle. What is Single Responsibility Principle? How do you use it? How does it help with making your software better? Let's get started.

REST API Best Practices - With Design Examples from Java and Spring Web Services

Designing Great REST API is important to have great microservices. How do you design your REST API? What are the best practices?

Designing REST API - What is Code First Approach?

Designing Great REST API is important to have great microservices. Code First approach focuses on generating the contract from code. Is it the best possible approach?