Learnitweb

Introduction to Spring Boot

According to the official documentation:

Spring Boot helps you to create stand-alone, production-grade Spring-based applications that you can run.

Why Spring Boot?

If you getting started with Spring framework, it may take some time to create production-grade application. Those who have worked with Spring can tell that configuring right set of dependencies takes some time while working with Spring. Spring Boot solves this problem. It is very simple to configure dependencies in case of Spring Boot. For example, when we declare the dependency of spring-boot-starter-web in Spring Boot application, it will automatically download all the required dependencies to create a web application.

Spring Boot comes with embedded servlet containers like Tomcat. So we do not need to even configure a servlet container to run our application. In short, a Spring Boot application comes with all the required dependencies configured to develop and run an application.

Most Spring Boot applications need very little Spring configuration to run and even if required, configuration can be done very easily without much effort.

Goals of Spring Boot

  • Provide faster way to get started with Spring application development.
  • Provide an easy way to get default dependencies for specific type of application or requirement. However, if the default dependencies are not required, the desired dependencies can be configured quickly.
  • Provide various features out of the box which are required by applications like embedded containers, security, health checks and many more.
  • Full support of annotation and no use of XML configuration.

System requirements

We’ll discuss system requirements of Spring Boot 2.5.5. Please check official documentation to check system requirements if your version is different.

  • Java 8 and is compatible up to Java 17.
  • Spring Framework 5.3.10 or above.

Support for build tools

Maven and Gradle are supported.

  • Maven: 3.5+
  • Gradle: 6.8.x, 6.9.x, and 7.x

Support for Servlet Containers

Spring Boot supports the following embedded servlet containers:

NameServlet Version
Tomcat 9.04.0
Jetty 9.43.1
Jetty 10.04.0
Undertow 2.04.0

You can also deploy Spring Boot applications to any Servlet 3.1+ compatible container.

Installation of Spring Boot

Spring Boot can be used with “classic” Java development tools. There is nothing specific about a Spring Boot application. It can be run and debug like any other Java program. We can use any IDE like Eclipse used for Java development to develop Spring Boot application. Spring Boot can also be installed as a command line tool.

To use Spring Boot, include appropriate spring-boot-*.jar on the classpath. It is recommended to use build tool like Maven or Gradle instead of manually including Jar files.

While working with Maven, Spring Boot dependencies use the org.springframework.boot groupId. Typically, our Maven POM file inherits from the spring-boot-starter-parent project and declares dependencies to one or more “Starters”.

While using Gradle, Spring Boot dependencies can be declared by using the org.springframework.boot group.

Spring Boot also provides optional Maven and Gradle plugins to create executable jars.

Conclusion

In this tutorial, we saw what is the purpose of Spring Boot. What are its goals and its benefits. In the next tutorial we’ll create our first Spring Boot application.