DEV Community

Cover image for Week 2: Spring Boot Essentials
Marc Vincent Bentoy
Marc Vincent Bentoy

Posted on

Week 2: Spring Boot Essentials

In the previous week, we explored the foundational ideas behind the Spring Framework—IoC, Dependency Injection, Beans, and the ApplicationContext. Now, let’s level up and move into the world of Spring Boot, a tool that supercharges the Spring experience with convention over configuration, faster development cycles, and production-ready features out of the box.


What is Spring Boot?

Spring Boot is not a replacement for the Spring Framework but a powerful extension that makes building and deploying Spring applications faster and easier. It removes the need for tedious configuration and lets you focus on writing business logic.

In short:

Spring is the foundation.

Spring Boot is the builder that lays everything down quickly for you.


Core Concepts We’ll Cover This Week

  • Spring Boot Starters
  • Auto-configuration
  • Devtools
  • Spring Initializr
  • A simple Hello World app

Spring Boot Starters

One of the coolest things about Spring Boot is its starter dependencies. Starters are pre-packaged sets of dependencies grouped together for common use cases.

Here are some common ones:

Starter Purpose
spring-boot-starter-web Build web, RESTful apps using Spring MVC
spring-boot-starter-data-jpa Integrate JPA for database access
spring-boot-starter-security Add security and authentication
spring-boot-starter-test Setup for testing Spring applications

With one line in your pom.xml or build.gradle, you get all the essential libraries and configurations.

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>
Enter fullscreen mode Exit fullscreen mode

Auto-Configuration

One of Spring Boot’s magic features is auto-configuration. Based on the dependencies in your project, Spring Boot will try to automatically configure your application.

For example:

  • If you include spring-boot-starter-web, it configures a web server (Tomcat) for you.
  • If it sees an H2 dependency, it sets up an in-memory database automatically.

This is enabled by the annotation:

@SpringBootApplication
Enter fullscreen mode Exit fullscreen mode

Which is actually a shortcut for:

@Configuration
@EnableAutoConfiguration
@ComponentScan
Enter fullscreen mode Exit fullscreen mode

It tells Spring Boot to scan for beans and apply sensible default configurations.


Spring Devtools

Spring Boot Devtools is a developer-friendly tool that allows hot reload and better productivity. It automatically restarts your application when you make code changes, so you don’t need to restart the server manually.

Add this to your pom.xml:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-devtools</artifactId>
    <scope>runtime</scope>
</dependency>
Enter fullscreen mode Exit fullscreen mode

Or in Gradle:

developmentOnly("org.springframework.boot:spring-boot-devtools")
Enter fullscreen mode Exit fullscreen mode

It also supports:

  • Automatic browser refresh
  • Disabling cache for static resources (CSS/JS)
  • Enhanced logging for debugging

Spring Initializr: Your Starter Buddy

You don’t need to manually create a project structure—use Spring Initializr!

Just select your dependencies, set your project metadata (group, artifact, Java version), and download a ready-to-run Spring Boot project.

Example setup:

  • Project: Maven
  • Language: Java
  • Spring Boot: 3.x
  • Dependencies: Spring Web, Spring Boot Devtools

Boom—you’re good to go.


Let’s Build Your First Spring Boot App

Here’s a basic REST controller:

@RestController
public class HelloController {

    @GetMapping("/")
    public String hello() {
        return "Hello, Spring Boot!";
    }
}
Enter fullscreen mode Exit fullscreen mode

And your entry point:

@SpringBootApplication
public class DemoApplication {
    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }
}
Enter fullscreen mode Exit fullscreen mode

Start it with:

./mvnw spring-boot:run
Enter fullscreen mode Exit fullscreen mode

Visit http://localhost:8080/ and you should see your message.


Final Thoughts

Spring Boot allows you to go from zero to production-ready in minutes. Once you grasp the starters, auto-config, and use devtools for faster feedback loops, it becomes a joy to build web services.

But remember: Spring Boot does a lot of things for you under the hood. As we continue this series, we’ll start pulling back the curtain to see exactly what’s going on in that "magic."


Up Next: Week 3 - Configuration Management

Next week, we’ll dive into application properties, YAML, profiles, and the @Value annotation. You’ll learn how to create environment-specific configs and keep secrets out of your code.

Top comments (0)