Spring Boot Interview Questions

By Aaron Cao · Updated

Spring Boot Interview Questions
Expect questions on autoconfiguration and starters, dependency injection and bean scopes, profiles and external configuration, Spring Data JPA, REST controllers and exception handling, testing slices, and Actuator. Senior rounds add transaction boundaries, caching, and how a service behaves across restarts.

Expect questions on autoconfiguration and starters, dependency injection and bean scopes, profiles and external configuration, Spring Data JPA, REST controllers and exception handling, testing slices, and Actuator. Senior rounds add transaction boundaries, caching, and how a service behaves across restarts.

What do interviewers ask about autoconfiguration and starters?

You probably use Spring Boot every day without reading its startup log, and interviewers know it, which is why they open here. This section covers the questions that check whether you understand the framework or only its defaults.

  • What does @SpringBootApplication actually combine, and what would break if you removed one part?
  • How does autoconfiguration decide what to configure, and what role do conditional annotations play?
  • What is a starter, and what is inside one besides dependencies?
  • How do you override or disable a specific autoconfiguration?
  • Where does an embedded server come from, and how would you swap it?

A good answer connects the mechanism to something you did: a bean you had to exclude, a starter you replaced, a startup failure you traced through the condition evaluation report.

Which core container and data questions come up?

  • Dependency injection. Constructor versus field injection, why constructor injection is preferred, and how to resolve two candidate beans of the same type.
  • Bean lifecycle and scopes. Why singleton is the default, when request or prototype scope is correct, and what makes a singleton bean unsafe to share.
  • Configuration. Property precedence, profiles per environment, and @ConfigurationProperties versus scattered value injection.
  • Spring Data JPA. Derived query methods, the N plus 1 problem, lazy versus eager fetching, and when to drop to a native query.
  • Transactions. What @Transactional proxies actually intercept, why a self-invocation silently skips the transaction, and how rollback rules work with checked exceptions.

The transaction proxy question is the single most common place a confident answer falls apart, so be ready to explain the proxy boundary rather than just naming the annotation.

How do you talk about REST design, testing, and operations?

Beyond the container, interviewers want the parts that show up in production. On the web layer: status code choices, validation, and centralized error handling with @ControllerAdvice instead of try-catch in every controller. On testing: the difference between a full @SpringBootTest and a slice such as a web-layer test, and why starting the whole context for one controller test is a slow habit. On operations: what Actuator exposes, which endpoints must not be public, and how health checks feed a deployment.

Consider a backend engineer interviewing for a mid-level role at a logistics company. She is asked why a scheduled job sometimes wrote partial data. Rather than guessing, she walks through the transaction boundary, notes the job called a transactional method on itself, and explains the proxy behavior that skipped it. The interviewer moved straight to an offer conversation, because the answer showed a debugging habit rather than a memorized definition.

Question sets for other languages and frameworks are collected under question banks.

How should you practice, and where does a live assistant fit?

Read your own service's startup log once and be able to narrate it. Then rehearse out loud, because the gap between knowing a concept and explaining it in forty seconds is where these rounds are decided. An AI interviewer on the /mock-interview page can ask the follow-ups you would not ask yourself.

During a spoken video interview, SubcueAI transcribes the interviewer's question and surfaces a suggested structure on your side, in the desktop overlay on macOS and Windows or in the Chromium browser extension side panel. No meeting bot joins the call, and nothing is injected into the meeting page. The honest limit is the coding round: if it moves onto a screen-monitored or proctored platform, live help is out of scope, and if you share your screen, everything on it is visible.

FAQ

What is the difference between Spring and Spring Boot?

Spring is the underlying framework. Spring Boot adds opinionated autoconfiguration, starter dependencies, and an embedded server so a service runs without external configuration files.

Why is constructor injection preferred?

It makes dependencies explicit and required, keeps fields final, and lets you build the object in a test without a container. Field injection hides missing dependencies until runtime.

What is the N plus 1 problem?

One query loads a list, then each element triggers another query for its association. Fix it with a fetch join, an entity graph, or batch fetching rather than eager loading everything.

Which Actuator endpoints are risky to expose?

Anything revealing configuration, environment, or heap state. Expose health and metrics through your monitoring path and keep the rest behind authentication or off entirely.

How deep do Spring Boot questions go for senior roles?

Senior rounds move from annotations to behavior: proxy boundaries, transaction propagation, caching correctness, startup performance, and how the service behaves during a rolling restart.

Related questions

← More on Interview Questions by Role & Topic