This section goes into more detail about how to use Spring Boot. It covers topics such as build systems, autoconfiguration, and application execution. We'll also look at some of the best practices for working with Spring Boot. While there's nothing special about Spring Boot (it's just another library you can use), there are a few best practices that can make your development process a little easier.

Build systems

It's highly recommended that you choose one a build system that supports dependency management and that can consume artifacts published in the "Maven Central" repository. We recommend choosing Maven or Gradle. It is possible to make Spring Boot work with other build systems (such as Ant), but they are not particularly well supported.

Dependency Management

Each release of Spring Boot provides a list of supported dependencies. In practice, there is no need to specify the version of any of these dependencies in your build configuration, since Spring Boot will do this for you. If you upgrade Spring Boot itself, then these dependencies will also be upgraded in a consistent manner.

You can still specify a version and override the recommended values for Spring Boot. if you need it.

This carefully curated list contains all the Spring modules that can be used with Spring Boot, as well as a refined list of third-party libraries. This list is available as a standard content pack (spring-boot-dependencies) that can be used with both Maven and Gradle.

Each Spring Boot release is bundled with a base version of the Spring Framework. We strongly recommend that you do not specify its version.


To learn about using Spring Boot with Maven, please refer to the Spring Boot Plugin for Maven documentation:


To learn about using Spring Boot with Gradle, please refer to the documentation for the Spring Boot plugin for Gradle:


You can build a project in Spring Boot using Apache Ant+Ivy. There is also an "AntLib" module spring-boot-antlib, which is designed to help Ant create executable jar files.

To declare dependencies, a typical file is ivy.xml looks something like the following example:

<ivy-module version="2.0">
    <info organisation="org.springframework.boot" module="spring-boot-sample-ant" />
        <conf name="compile" description="everything needed to compile this module" />
        <conf name="runtime" extends="compile" description="everything needed to run this module" />
        <dependency org="org.springframework.boot" name="spring-boot-starter"
                    rev="${spring-boot.version}" conf="compile" />

A typical build.xml looks like this:

        name="myapp" default="build">
    <property name="spring-boot.version" value="2.7.5" />
    <target name="resolve" description="--> retrieve dependencies with ivy">
        <ivy:retrieve pattern="lib/[conf]/[artifact]-[type]-[revision].[ext]" />
    <target name="classpaths" depends="resolve">
        <path id="compile.classpath">
            <fileset dir="lib/compile" includes="*.jar" />
    <target name="init" depends="classpaths">
        <mkdir dir="build/classes" />
    <target name="compile" depends="init" description="compile">
        <javac srcdir="src/main/java" destdir="build/classes" classpathref="compile.classpath" />
    <target name="build" depends="compile">
        <spring-boot:exejar destfile="build/myapp.jar" classes="build/classes">
                <fileset dir="lib/runtime" />

Starter packages

Starter packages are a set of convenient dependency descriptors that you can include in your application. You get a one-stop shop for all the Spring and related technologies you need, without having to hunt through code examples and copy and paste a bunch of dependency descriptors. For example, if you want to start using Spring and JPA for database access, include the spring-boot-starter-data-jpa dependency in your project.

Starter packages contain many dependencies needed to get your project up and running quickly with a consistent, compatible set of manageable transition dependencies.

What does the name mean?

All official starter packages have the same name: spring-boot-starter-*, where * is a specific type of application. This naming structure is intended to help if you need to find a starter package. Maven integration in many IDEs allows you to search for dependencies by name. For example, if you have the appropriate plugin for Eclipse or Spring Tools installed, you can press ctrl-space in the POM editor and type "spring-boot-starter" to get the full list.

Third-party starter packages should not start with spring-boot, as this name is reserved for official Spring Boot artifacts. Rather, a third-party starter package usually starts with the name of the project. For example, a third party starter project called thirdpartyproject is usually called thirdpartyproject-spring-boot-starter.

The following starter packages for applications, Spring Boot is provided within the org.springframework.boot group:

Table 1. Starter packages for Spring Boot applications
Name Description


Basic starter package, including support for autoconfiguration, logging and YAML


Starter package for JMS messaging using Apache ActiveMQ


Starter package for using Spring AMQP and Rabbit MQ


Starter package for aspect-oriented programming using Spring AOP and AspectJ


Starter package for JMS messaging using Apache Artemis


Starter package for using Spring Batch


Starter package for using caching support in the Spring Framework


Starter package for using the distributed database Cassandra and Spring Data Cassandra


Starter package for using a distributed database of Cassandra and Spring Data Cassandra Reactive


Starter package for using the document-oriented database Couchbase and Spring Data Couchbase

spring -boot-starter-data-couchbase-reactive

Starter package for using Couchbase document-oriented database and Spring Data Couchbase Reactive


Starter package for using the search and analytical engine Elasticsearch and Spring Data Elasticsearch


Starter package to use Spring Data JDBC

spring -boot-starter-data-jpa

Starter package for using Spring Data JPA with Hibernate


Starter package for using Spring Data LDAP


Starter package for using MongoDB document-oriented database and Spring Data MongoDB

spring-boot-starter- data-mongodb-reactive

Starter package for using MongoDB document-oriented database and Spring Data MongoDB Reactive


Starter package for using the Neo4j graph database and Spring Data Neo4j


Starter package for using Spring Data R2DBC

spring-boot-starter-data -redis

Starter package for using the Redis key-value data store via Spring Data Redis and the Lettuce client


Starter package for using Redis key-value data store via Spring Data Redis reactive store and Lettuce client


Starter package for opening Spring Data repositories on top of REST using Spring Data REST


Starter package for building MVC web applications using FreeMarker views


Starter package for creating GraphQL applications using Spring GraphQL


Starter package for creating a web MVC Applications Using Views Groovy Templates

spring -boot-starter-hateoas

Starter package for building a RESTful hypermedia-based web application via Spring MVC and Spring HATEOAS


Starter package for using Spring Integration


Starter package for using JDBC with HikariCP connection pool


Starter package for creating RESTful web applications using JAX-RS and Jersey.


Starter package for using jOOQ to provide access to databases SQL data using JDBC.


Starter package for reading and writing json


Starter package for JTA- transactions using Atomikos

spring-boot- starter-mail

A starter package for using Java Mail and the Spring Framework email support facilities


Starter package for building web applications using Mustache views


Starter package for using Spring Security OAuth2/OpenID Connect client features

spring-boot-starter-oauth2 -resource-server

Starter package for using OAuth2 resource server features in Spring Security


Starter package for using the Quartz scheduler


Starter package for creating RSocket clients and servers


Starter package to use Spring Security

spring-boot- starter-test

A starter package for testing Spring Boot applications using libraries including JUnit Jupiter, Hamcrest and Mockito


Starter package for building MVC web applications using Thymeleaf views


Starter package for using Java Bean Validation with Hibernate Validator


Starter package for creating web applications, including RESTful, using Spring MVC. Uses Tomcat as default embedded container


Starter package for using Spring Web Services


Starter package for building WebFlux applications using Reactive Web support in the Spring Framework


Starter package for creating WebSocket applications using WebSocket support in the Spring Framework< /p>

In addition to application starter packs, the following starter packs can be used to add production-ready functionality:

Table 2. Spring Boot production starter packages
Name Description


A starter package for using Actuator from Spring Boot, which provides features for production deployment , which help you monitor and manage your application

Finally, Spring Boot also contains the following starter packages that you can use if you want to exclude or swap certain technical aspects:

Table 3. Spring Boot technical starter packages
Name Description


Starter package for using Jetty in as an embedded servlet container.

spring-boot -starter-log4j2

Starter package for using Log4j2 for logging purposes.


Starter package for logging using Logback. Default logging starter package


A starter package for using Reactor Netty as a built-in reactive HTTP server.


Starter package for using Tomcat as an embedded servlet container. The default starter package for the servlet container used by spring-boot-starter-web


Starter package for using Undertow as an embedded servlet container .

For a list of additional community-contributed starter packs, see README file in the spring-boot-starters module on GitHub.

Code Structuring

Spring Boot does not require any specific code structure to work. However, there are some best practices that are useful.

Using the "default" package

If a class does not contain a package declaration, it is considered to be in " package by default." Using the "default package" is generally not recommended and should be avoided. This may cause specific problems for Spring Boot applications that use the @ComponentScan, @ConfigurationPropertiesScan, @EntityScan or @SpringBootApplication as each class is read from each jar file.

We recommend following the recommended Java package naming conventions and using the reverse domain name ( for example, com.example.project).

Placing the main application class

It is generally recommended to place the main application class in the root package above other classes. The @SpringBootApplication annotation is often placed in the main class, and it implicitly defines a base "search package" for certain elements. For example, if you are writing a JPA application, the class package marked with the @SpringBootApplication annotation is used to find elements with the @Entity annotation. Using a root package also allows you to apply component scanning exclusively to your project.

If you don't want to use the @SpringBootApplication annotation The @EnableAutoConfiguration and @ComponentScan that the package imports define the same logic, so you can use them instead.

The list below shows typical structure:

 +- example
     +- myapplication
         +- customer
         |   +-
         |   +-
         |   +-
         |   +-
         +- order

In the file the main method together with the base @SpringBootApplication will be declared as follows:

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
public class MyApplication {
    public static void main(String[] args) {, args);
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication
class MyApplication
fun main(args: Array<String>) {