LearnThatStack Ace your next interview
Backend Development

Spring Boot.

Start free Change topic Change
Practice · Questions

All questions

Showing of 72
Beginner 20
01

Explain the difference between Spring and Spring Boot.

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

Spring is the core framework that you configure yourself, while Spring Boot configures it for you. Spring Boot is built on top of Spring and adds opinionated defaults, so a new application runs with almost no setup.

Aspect Spring Spring Boot
Configuration Manual XML/Java configuration Auto-configuration
Server Setup External server required Embedded server included
Dependencies Manual dependency management Starter dependencies
Deployment WAR files to external servers Executable JAR files
Development Time More setup and configuration Faster development

Spring Boot does not replace Spring. Its auto-configuration creates the beans you would otherwise declare by hand, based on the libraries on the classpath. Starters add a tested set of libraries with one dependency. The embedded server lets you start the app with java -jar.

Your own configuration still takes precedence. When you declare a bean yourself, Spring Boot skips its default for that bean.

The deployment row is the usual case, not a limit. A Spring Boot app can still be packaged as a WAR for an external server, by extending SpringBootServletInitializer.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

02

What are Spring Boot Starters? Name some commonly used starters.

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

Spring Boot starters are dependency descriptors that bring in everything one feature needs through a single entry in your build file. Add spring-boot-starter-data-jpa, and you get Spring Data JPA and Hibernate at versions tested together.

Commonly used starters:

  • spring-boot-starter-webmvc: web apps and REST APIs with Spring MVC and Tomcat. Before Spring Boot 4 it was spring-boot-starter-web, which still works but is deprecated.
  • spring-boot-starter-data-jpa: JPA with Hibernate
  • spring-boot-starter-security: Spring Security
  • spring-boot-starter-test: testing with JUnit and Mockito
  • spring-boot-starter-actuator: monitoring and management
  • spring-boot-starter-data-redis: Redis data access
  • spring-boot-starter-mail: email support

You leave the versions off. Spring Boot's dependency management picks them, so upgrading Spring Boot upgrades the whole set.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

03

Explain the @SpringBootApplication annotation.

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

@SpringBootApplication is a convenience annotation that combines three annotations. One line on the main class registers your configuration and turns on auto-configuration and component scanning.

@SpringBootApplication
public class Application {
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}

It is equivalent to:

  • @SpringBootConfiguration: marks the class as a source of beans. It is a specialized @Configuration that also helps tests find your configuration.
  • @EnableAutoConfiguration: turns on auto-configuration, which creates beans from the libraries on the classpath.
  • @ComponentScan: scans the current package and its sub-packages for components.

Scanning starts at the package of this class, so put the main class in a root package above your other classes.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

04

What is the difference between @Component, @Service, @Repository, and @Controller?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

All four mark a class as a Spring bean that component scanning picks up. They are stereotype annotations, and @Service, @Repository and @Controller are specializations of @Component that also name the layer the class belongs to.

  • @Component is the generic stereotype for any Spring-managed class.
  • @Service marks business logic in the service layer.
  • @Repository marks data access. It also turns on exception translation, which converts database-specific exceptions into Spring's DataAccessException hierarchy.
  • @Controller marks the presentation layer. Spring MVC treats these classes as handlers for HTTP requests.
@Service
public class UserService { }
@Repository
public class UserRepository { }
@Controller
public class UserController { }

For component scanning, the four behave the same. The specific annotation still matters, because tools and aspects can target a layer by its annotation. Spring may also give these annotations more behavior in future versions, so use the one that matches the role of the class.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

05

How do you create a RESTful web service in Spring Boot?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

You create a REST service by adding the web starter and writing a class annotated with @RestController. Each handler method maps an HTTP method and a path to Java code, and Spring converts the return value to JSON.

  1. Add the web starter, spring-boot-starter-webmvc, named spring-boot-starter-web before Spring Boot 4. It brings Spring MVC, the Jackson JSON library and an embedded Tomcat web server.
  2. Annotate a class with @RestController and give it a base path with @RequestMapping.
  3. Map each operation with a shortcut annotation that has the HTTP method built in, such as @GetMapping or @PostMapping.
  4. Read input with @PathVariable for a path segment and @RequestBody for a JSON body.
@RestController
@RequestMapping("/api/users")
public class UserController {
    @Autowired
    private UserService userService;
    @GetMapping
    public List<User> getAllUsers() {
        return userService.findAll();
    }
    @GetMapping("/{id}")
    public User getUser(@PathVariable Long id) {
        return userService.findById(id);
    }
    @PostMapping
    public User createUser(@RequestBody User user) {
        return userService.save(user);
    }
    // ...
}

Start the @SpringBootApplication main class, and a GET request to /api/users/1 returns that user as JSON. To choose the status code yourself, return a ResponseEntity, for example 201 Created from the POST method.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

06

What is the difference between @RequestMapping and @GetMapping?

Part of Pro
07

Explain Spring Boot's embedded server concept.

Part of Pro
08

What are the different ways to run Spring Boot applications?

Part of Pro
09

What is the difference between @RestController and @Controller?

Part of Pro
10

What are Spring Boot DevTools and how do they improve development?

Part of Pro
11

Explain Inversion of Control (IoC) and Dependency Injection (DI).

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

Inversion of Control (IoC) is the principle that a container, not your code, creates objects and manages them. In Spring that container is usually an ApplicationContext. Dependency Injection (DI) is how Spring puts IoC into practice. An object declares what it needs, and the container passes those dependencies in.

// Without DI - tight coupling
public class UserService {
    private UserRepository userRepository = new UserRepository(); // Tight coupling
}

// With DI - loose coupling
public class UserService {
    private UserRepository userRepository;
    
    public UserService(UserRepository userRepository) {
        this.userRepository = userRepository; // Dependency injected
    }
}

In the first class, UserService builds its own UserRepository with new, so the two are tightly coupled. You cannot swap in another implementation or a test mock without editing the class.

In the second class, the dependency arrives through the constructor. Spring chooses what to inject, and a unit test can pass a mock. That is loose coupling.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

12

What are the different types of Dependency Injection in Spring?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

Spring supports three types of dependency injection: constructor, setter and field injection.

  1. Constructor injection passes dependencies as constructor arguments.
  2. Setter injection calls a setter marked with @Autowired after the object is created.
  3. Field injection puts @Autowired on a field, and Spring sets it through reflection.
// Constructor Injection (Recommended)
@Service
public class UserService {
    private final UserRepository userRepository;
    public UserService(UserRepository userRepository) {
        this.userRepository = userRepository;
    }
}

// Field Injection
@Service
public class UserService {
    @Autowired
    private UserRepository userRepository;
}

Prefer constructor injection. The fields can be final, the object never exists without its dependencies, and a test can pass mocks to the constructor with no container. A class with one constructor needs no @Autowired on it.

Use setter injection for optional dependencies. Avoid field injection, because it hides what a class needs and makes it hard to test without Spring.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

13

What are the different ways to configure Spring applications?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

Spring supports three ways to configure an application: XML files, annotations on your classes, and Java configuration classes.

  1. XML-based configuration declares beans and their wiring in XML files. It appears mostly in older projects.
  2. Annotation-based configuration marks classes with @Component and injection points with @Autowired, and component scanning finds them.
  3. Java-based configuration uses @Configuration classes whose @Bean methods create beans.
// Java-based configuration
@Configuration
public class AppConfig {
    @Bean
    public UserService userService() {
        return new UserService(userRepository());
    }
    
    @Bean
    public UserRepository userRepository() {
        return new UserRepository();
    }
}

Most applications mix the last two. Annotations cover your own classes, and @Bean methods cover third-party classes you cannot annotate. Spring Boot can still load an old XML file with @ImportResource.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

14

What is @Autowired and how does it work?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

@Autowired tells Spring to inject a dependency automatically. Spring finds the bean whose type matches the field or parameter, which is matching by type, and passes it in.

You can put it on:

  • constructors
  • setter methods, and other methods with any name
  • fields
  • method parameters
@Service
public class UserService {
    @Autowired
    private UserRepository userRepository; // Field injection
    
    @Autowired
    public UserService(UserRepository userRepository) { // Constructor injection
        this.userRepository = userRepository;
    }
}

The example uses two places at once only to show both. In real code you pick one, usually the constructor. When a class has a single constructor, that constructor needs no @Autowired.

Every place Spring fills is required by default, so startup fails when no bean matches. Use @Autowired(required = false) or Optional for an optional dependency. When several beans match, choose one with @Qualifier or mark one bean @Primary.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

15

What is Spring Boot and what are its advantages?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

Spring Boot is an opinionated framework on top of Spring that gets a production-ready application running with little setup. It follows convention over configuration, so it picks sensible defaults and you override only what you need.

Its main advantages:

  • Auto-configuration creates beans from the libraries on the classpath, with no XML.
  • Starter dependencies add a tested set of libraries with one dependency.
  • An embedded server, Tomcat by default or Jetty, runs inside the app.
  • The app ships as one executable JAR that starts with java -jar.
  • Actuator adds health checks and metrics.
  • Externalized configuration keeps settings in properties files and environment variables, outside the code.

The trade-off is that much happens implicitly, so you must know what to override when a default does not fit.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

16

Explain @PathVariable, @RequestParam, and @RequestBody.

Part of Pro
17

What is Spring Data and what are its key features?

Part of Pro
18

What is Spring Security and what are its core features?

Part of Pro
19

Explain authentication vs authorization in Spring Security.

Part of Pro
20

What is Spring Initializr?

Part of Pro
Intermediate 40
21

What is auto-configuration in Spring Boot? How does it work?

Part of Pro
22

How do you configure different environments in Spring Boot?

Part of Pro
23

What is Spring Boot Actuator and what are its key features?

Part of Pro
24

How do you handle exceptions globally in Spring Boot?

Part of Pro
25

What is Spring Data JPA and how do you use it in Spring Boot?

Part of Pro
26

Explain the difference between @Autowired, @Inject, and @Resource.

Part of Pro
27

How do you implement validation in Spring Boot?

Part of Pro
28

What are Spring Boot profiles and how do you use them?

Part of Pro
29

How do you configure and use caching in Spring Boot?

Part of Pro
30

What is the difference between @Component and @Bean?

Part of Pro Visual
31

How do you implement security in Spring Boot?

Part of Pro
32

How do you test Spring Boot applications?

Part of Pro
33

What is the difference between @MockBean and @Mock?

Part of Pro
34

How do you implement asynchronous processing in Spring Boot?

Part of Pro Visual
35

How do you implement custom health checks in Spring Boot Actuator?

Part of Pro
36

How do you implement pagination and sorting in Spring Boot?

Part of Pro
37

Explain Spring Boot's logging configuration.

Part of Pro
38

How do you implement database migration in Spring Boot?

Part of Pro
39

Explain Spring Boot's transaction management.

Part of Pro Visual
40

How do you implement file upload and download in Spring Boot?

Part of Pro
41

What is the Spring IoC Container and what are its types?

Part of Pro
42

Explain the different bean scopes in Spring.

Part of Pro Visual
43

Explain the Spring Bean lifecycle.

Part of Pro
44

Explain Spring Boot application properties and profiles.

Part of Pro
45

What is Spring MVC and how does its architecture work?

Part of Pro
46

What is DispatcherServlet and what is its role?

Part of Pro
47

Explain different types of controllers in Spring MVC.

Part of Pro
48

Explain JpaRepository and its hierarchy.

Part of Pro Visual
49

How do query methods work in Spring Data JPA?

Part of Pro Visual
50

What is @Query annotation and when would you use it?

Part of Pro Visual
51

What are the different authentication methods in Spring Security?

Part of Pro
52

What is Aspect-Oriented Programming (AOP) in Spring?

Part of Pro Visual
53

What are the different types of advice in Spring AOP?

Part of Pro
54

What is @SpringBootTest and its different modes?

Part of Pro Visual
55

How do you test web controllers?

Part of Pro
56

What happens when a Spring Boot application starts?

Part of Pro Visual
57

What is the difference between RestTemplate, WebClient and RestClient?

Part of Pro
58

What is Spring Boot's approach to microservices?

Part of Pro
59

What is Spring WebFlux and how does it differ from Spring MVC?

Part of Pro Visual
60

What is Spring Cloud and its key components?

Part of Pro
Expert 12
61

Explain Spring Boot's auto-configuration process with @ConditionalOn annotations.

Part of Pro Visual
62

Explain Spring Boot's configuration precedence.

Part of Pro
63

How do you implement custom auto-configuration in Spring Boot?

Part of Pro
64

Explain Spring Security's filter chain.

Part of Pro
65

How do you implement JWT authentication in Spring Security?

Part of Pro Visual
66

What is the difference between JDK dynamic proxy and CGLIB proxy?

Part of Pro Visual
67

Explain Spring's event handling mechanism.

Part of Pro Visual
68

What is @Conditional annotation and its use cases?

Part of Pro
69

How does Spring handle circular dependencies?

Part of Pro Visual
70

What is Spring's ApplicationContext hierarchy?

Part of Pro
71

Explain Spring's BeanPostProcessor and BeanFactoryPostProcessor.

Part of Pro
72

What makes a Spring Boot application start slowly, and how do you fix it?

Part of Pro

No matches

Try a different filter or search term.

Know someone prepping for Spring Boot? Send them this set.
Quick recap

Spring Boot in pictures.

A quick recap of Spring Boot in 31 short animated pictures, one idea at a time. About 8 min to get the whole topic back in your head before you walk in. Pause any picture, slow it down, or step through it.

Pro The first chapter is free to play. The other 29 pictures come with Pro.

Get Pro · $10/mo
Pro · $10/mo

62 of 72 Spring Boot answers are in Pro.

Full answers, code samples, and AI explanations that go simpler or deeper. Cancel anytime.

  • Full answers + code
  • AI explanations, simpler or deeper
  • 1,000 AI credits / month
  • Cancel anytime

Change topic

Pick a different technology or stack. Your current topic stays put until you choose a new one.

Technologies
No technologies match “”.
Cross-cutting topics
No topics match “”.
By role
Stacks & frameworks

MEAN

MongoDB, Express, Angular, Node.js

MERN

MongoDB, Express, React, Node.js

LAMP

Linux, Apache, MySQL, PHP

Django

Python Full-Stack Development

Ruby on Rails

Convention over Configuration

Serverless on AWS

Serverless Architecture on AWS

Flutter Mobile

Flutter Cross-Platform Mobile Development

Spring Boot

Enterprise Java Development

.NET

Microsoft Ecosystem

Vue

Vue.js, Vite, TypeScript, Tailwind, Node.js

Go Backend

Golang, gRPC, PostgreSQL, Redis, RabbitMQ

FastAPI

Python, FastAPI, SQLAlchemy, PostgreSQL

React Native

React, TypeScript, Redux, Firebase

iOS Native

Swift, SwiftUI, UIKit, Firebase

Android Native

Java, Jetpack Compose, Firebase

DevOps / Platform

Docker, Kubernetes, Terraform, CI/CD

AI Engineer

LLMs, RAG, Agents, Evals

AI-Powered Developer

Claude Code, Copilot, Agentic Workflows

Core SWE Interview Prep

Data structures, algorithms, OS, concurrency, networking, git