Why this topic matters
Spring Boot sits on top of the Spring Framework and adds three things that the framework itself does not provide: an opinionated auto-configuration that wires up beans based on what is on the classpath, an embedded HTTP server (Tomcat by default) that lets you ship a single executable JAR, and a starter-dependency model that gets a runnable application going in minutes. Together these three additions take Spring from “a powerful but configuration-heavy framework” to “a single command that produces a runnable web app.”
Knowing Spring Boot is a job-market skill. Most enterprise Java backend roles — at banks, retailers, telecoms, SaaS companies, healthcare systems — expect Spring Boot fluency. The framework's conventions are so dominant that a job posting saying “Java backend” almost always means “Java backend with Spring Boot.” If you are looking for a Java job, this is the topic to study.
Spring Boot is also the gateway to the wider Spring ecosystem: Spring Security for authentication, Spring Data JPA for database access, Spring Cloud for distributed systems, Spring Batch for batch processing, Spring Integration for messaging. Each is a substantial framework on its own, but all build on the same core: Spring's dependency injection container, the auto-configuration model, and the starter-dependency approach.
What you will learn
You will learn how to scaffold a Spring Boot application with start.spring.io, define REST controllers with @RestController and the mapping annotations, persist data with Spring Data JPA repositories (which implement CRUD operations from interface method names), secure endpoints with Spring Security, handle errors globally with @RestControllerAdvice, write tests with @SpringBootTest and MockMvc, and package the application as an executable JAR with an embedded Tomcat.
You will also learn enough about the underlying Spring Framework — dependency injection, the application context, beans, profiles — to debug problems when the auto-configuration does the wrong thing. Spring Boot's auto-configuration is a black box until something goes wrong, and debugging it requires understanding what it is doing underneath.
Core concepts
- ApplicationContext — the Spring container that holds and wires beans.
- Bean — an object managed by the Spring container.
- Dependency injection — the container injects collaborators into your beans via constructor.
- Auto-configuration — Spring Boot wires beans based on classpath contents and configuration properties.
- Starter dependency — a Maven/Gradle dependency that pulls in everything needed for a feature.
- @RestController — a controller that returns JSON; combines
@Controllerand@ResponseBody. - @GetMapping / @PostMapping — map HTTP methods to handler methods.
- @Entity — mark a class as a JPA entity mapped to a database table.
- JpaRepository — a repository interface that Spring Data JPA implements at runtime.
- application.properties — the configuration file Spring Boot reads on startup.
- Profile — a named configuration set; switch with
--spring.profiles.active=dev.
Common pitfalls
- Field injection. Use constructor injection instead — it makes dependencies explicit, allows
finalfields, and makes the class testable without Spring. - N+1 queries in JPA. Loading a list of entities and accessing a lazy association triggers one SQL per entity. Use fetch-join or
@EntityGraph. - Letting Hibernate manage schema in production.
spring.jpa.hibernate.ddl-auto=updateis fine for development but should be replaced with a migration tool (Flyway, Liquibase) in production. - Catching everything in controllers. Use
@RestControllerAdvicewith@ExceptionHandlerso controllers stay thin. - Forgetting to shut down the application context. Spring Boot's Maven plugin handles this; running the JAR directly should use
SIGTERMhandling for graceful shutdown.
Best practices
- Use constructor injection; make dependencies
final. - Keep controllers thin — delegate to services that contain the business logic.
- Keep services thin — delegate to repositories for persistence and to other services for cross-cutting concerns.
- Validate input at the controller boundary with
@Validand Bean Validation annotations. - Use a migration tool (Flyway or Liquibase) for schema; never let Hibernate auto-update production.
- Write tests:
@WebMvcTestfor controllers,@DataJpaTestfor repositories,@SpringBootTestfor end-to-end. - Externalise configuration: use
application.yml, profiles, and environment variables for secrets.
Frequently asked questions
Do I need to learn the underlying Spring Framework before Spring Boot?
No. Spring Boot is the recommended starting point for new Java developers today. Start with Spring Boot, learn its conventions, and pick up the underlying Spring Framework concepts as needed when debugging. Trying to learn the entire Spring Framework first is overwhelming and most of it is hidden by Spring Boot's auto-configuration.
Spring Boot or Quarkus?
Spring Boot is the safer choice for most projects — larger community, more libraries, more documentation, more experienced hires. Quarkus is faster to start and uses less memory, which matters for serverless deployments and short-lived functions. If you are not sure, pick Spring Boot. The skills transfer to Quarkus if you switch later.
How do I debug Spring Boot's auto-configuration?
Start the application with --debug — Spring Boot prints a “CONDITIONS EVALUATION REPORT” showing which auto-configuration classes matched and which did not, with reasons. This is the single most useful debugging tool for Spring Boot. For bean-wiring problems, set logging.level.org.springframework=DEBUG.
How should I deploy a Spring Boot app?
The simplest path is to build the executable JAR with mvn package and run it with java -jar on a VM or in a container. For Kubernetes, build a slim Docker image based on eclipse-temurin and run the JAR as the container's entrypoint. For serverless, consider Google Cloud Run, AWS Lambda with the Spring Cloud Function adapter, or a service like Azure Spring Apps.
Tutorials in this topic
- Spring Boot — scaffold, REST controller, JPA, security, testing, deployment.
- JDBC — Spring Data JPA builds on the JDBC concepts; understand both.