Skip to content
Spring Boot interview handbook · PDF ebook

Answer Spring Boot questions like a backend engineer.

100 questions from IoC and auto-configuration to JPA, transactions, Spring Security with JWT, microservices, Redis and Kafka, ending with 10 real SDE-2 production scenarios.

100
questions
10
chapters
10
SDE-2 scenarios
7
day revision plan
₹199₹39950% off
  • Secure checkout via Razorpay
  • Digital PDF ebook
  • Read on phone, tablet or laptop
Master Springboot Interview ebook coverPDF ebook
At a glance

What is the Spring Boot Interview Handbook?

The Spring Boot Interview Handbook is a digital PDF ebook by Target Trek with 100 Spring Boot interview questions and answers in 10 chapters, covering Spring Core and dependency injection, REST APIs, Spring Data JPA, transactions, Spring Security with JWT, microservices, Redis and Kafka. It ends with 10 real-world backend scenarios of the kind asked in SDE-2 interviews.

  • Auto-configuration
  • IoC & DI
  • Bean lifecycle
  • REST APIs
  • Validation
  • Spring Data JPA
  • Hibernate
  • N+1 problem
  • @Transactional
  • Spring AOP
  • Spring Security
  • JWT
  • OAuth2
  • Microservices
  • Redis
  • Kafka
  • Actuator
  • Testcontainers
Format
Digital PDF ebook
Questions
100, with answers
Chapters
10 · Q1 to Q100
Levels
Beginner → Scenario
Prerequisite
Basic Core Java
Best for
Freshers to SDE-2
Reads on
Phone, tablet, laptop
Publisher
Target Trek
Why this book

Stop memorising annotations. Explain them.

Interviewers ask what @Transactional does, then why it did not roll back. This book prepares you for the second question.

  • Without a plan: Memorising annotations without knowing how they work

    With this handbook: Internals explained: proxies, bean lifecycle and auto-configuration

  • Without a plan: Knowing CRUD but freezing on transaction and locking questions

    With this handbook: JPA, transactions and concurrency covered with code

  • Without a plan: Theory-only answers when asked what happens if production breaks

    With this handbook: A full chapter of real-world SDE-2 backend scenarios

  • Without a plan: Scattered notes across blogs and videos

    With this handbook: 100 questions, 10 chapters, one revision plan

What makes it different

  • Understand the why

    Go beyond definitions and learn how Spring Boot components actually work underneath.

  • Learn through Java code

    Annotations, configuration and real implementation patterns, shown in short runnable snippets.

  • Answer with confidence

    A concise answer for each question, plus the deeper concept behind the likely follow-up.

  • Think like a backend engineer

    Connect every concept to REST APIs, databases, security, concurrency and production systems.

  • SDE-1 to SDE-2

    Climb from fundamentals to internals, architecture and troubleshooting scenarios.

  • Revise efficiently

    Questions grouped by topic, chapter summaries and a 7-day plan for the week before.

Choose your book

The Java backend interview series

Core Java is the first round, Spring Boot is the backend round and LLD is the design round. Each book stands alone, and together they cover a full Java SDE interview loop.

This page
Spring Boot · 100 Q&A

Master Springboot Interview

IoC and DI, REST APIs, Spring Data JPA, transactions and AOP, Security with JWT, microservices, Redis, Kafka and real scenarios.

  • 100 questions in 10 chapters
  • Java and Spring code examples
  • 10 SDE-2 backend scenarios
₹199₹39950% off
Core Java · 100 Q&A

Master Java Interviews

Core Java, OOP, Strings, Collections and HashMap internals, Streams, multithreading, JVM and modern Java 17 / 21.

  • 100 questions in 12 chapters
  • Output puzzles and coding questions
  • JVM, GC and concurrency internals
₹199₹39950% off
Details
Low-level design · Java

Mastering System Design LLD

Turn requirements into clean object models, apply SOLID and design patterns, and practise complete Java LLD problems.

  • Java, OOP, SOLID and UML
  • 23 GoF design patterns
  • 16 detailed LLD case studies
₹299₹59950% off
Details
Complete syllabus

All 100 questions, chapter by chapter

This is the full list. Filter by level, search for a topic such as JWT or N+1, and open any chapter to see every question in it.

  • 10Beginner
  • 20Core
  • 10Intermediate
  • 50Advanced
  • 10Scenario

100 of 100 questions

01Spring & Spring Boot FundamentalsQ1–Q10 · 10 questionsBeginner

What Spring Boot adds on top of Spring: auto-configuration, starters, startup, embedded servers and configuration.

  1. Q1What is Spring Boot and why is it used?
  2. Q2How is Spring Boot different from Spring?
  3. Q3What are its advantages and limitations?
  4. Q4What does @SpringBootApplication do?
  5. Q5How does auto-configuration work?
  6. Q6What are Spring Boot starters?
  7. Q7What happens during application startup?
  8. Q8What is an embedded server?
  9. Q9What is the difference between JAR and WAR?
  10. Q10How does externalized configuration work?
02Spring Core, IoC & Dependency InjectionQ11–Q20 · 10 questionsCore

The container itself: inversion of control, injection styles, beans, scopes and the bean lifecycle.

  1. Q11What is Inversion of Control?
  2. Q12What is dependency injection?
  3. Q13Why is constructor injection preferred?
  4. Q14What exactly is a Spring Bean?
  5. Q15Compare the stereotype annotations
  6. Q16How are @Bean and @Component different?
  7. Q17What are the different bean scopes?
  8. Q18Explain the Spring Bean lifecycle
  9. Q19What is ApplicationContext?
  10. Q20Explain @Primary, @Qualifier and @Lazy
03REST APIs & Exception HandlingQ21–Q30 · 10 questionsCore

Building clean APIs: controllers, mappings, DTOs, validation, global error handling and pagination.

  1. Q21How do you create REST APIs?
  2. Q22@Controller vs @RestController
  3. Q23Explain the HTTP mapping annotations
  4. Q24@PathVariable vs @RequestParam
  5. Q25When should ResponseEntity be used?
  6. Q26How does JSON conversion work?
  7. Q27How does request validation work?
  8. Q28How do you handle exceptions globally?
  9. Q29What is the difference between PUT and PATCH?
  10. Q30How do pagination and sorting work?
04Spring Data JPA & HibernateQ31–Q40 · 10 questionsIntermediate

Database access done right: repositories, mappings, fetching, the N+1 problem, locking and migrations.

  1. Q31JPA vs Hibernate vs Spring Data JPA
  2. Q32CrudRepository vs JpaRepository
  3. Q33What are the JPA entity annotations?
  4. Q34Explain entity relationships and cascading
  5. Q35Lazy loading vs eager loading
  6. Q36What is the N+1 query problem?
  7. Q37save() vs flush() vs saveAndFlush()
  8. Q38JPQL vs native SQL
  9. Q39Optimistic vs pessimistic locking
  10. Q40How do connection pooling and migrations work?
05Transactions, AOP & InternalsQ41–Q50 · 10 questionsAdvanced

What happens behind the annotations: proxies, propagation, isolation, AOP and circular dependencies.

  1. Q41How does @Transactional work?
  2. Q42What are the transaction propagation types?
  3. Q43Explain transaction isolation levels
  4. Q44Why does @Transactional sometimes fail?
  5. Q45What is Spring AOP?
  6. Q46JDK dynamic proxy vs CGLIB
  7. Q47What are the different types of advice?
  8. Q48How does Spring handle circular dependencies?
  9. Q49Explain bean lifecycle hooks and BeanPostProcessor
  10. Q50How does Spring event publishing work?
06Spring Security, JWT & OAuth2Q51–Q60 · 10 questionsAdvanced

Authentication and secure APIs: the filter chain, JWT, OAuth2 and OIDC, RBAC, CORS, CSRF and passwords.

  1. Q51How does Spring Security work?
  2. Q52Authentication vs authorization
  3. Q53How do you implement JWT authentication?
  4. Q54Session vs JWT authentication
  5. Q55Explain OAuth2, OIDC and JWT
  6. Q56How do you implement role-based access control?
  7. Q57What is CORS?
  8. Q58What is CSRF?
  9. Q59How should passwords be stored?
  10. Q60How do you secure production APIs?
07Spring Boot MicroservicesQ61–Q70 · 10 questionsAdvanced

Services that talk to each other and survive failure: clients, discovery, gateways, resilience and sagas.

  1. Q61Microservices vs monolithic architecture
  2. Q62How do microservices communicate?
  3. Q63RestTemplate vs RestClient vs WebClient
  4. Q64What is service discovery?
  5. Q65What is an API Gateway?
  6. Q66How does a circuit breaker work?
  7. Q67Explain retry, timeout and bulkhead
  8. Q68What is the Saga pattern?
  9. Q69How is configuration managed centrally?
  10. Q70How does distributed tracing work?
08Redis, Kafka & Async ProcessingQ71–Q80 · 10 questionsAdvanced

Real-world integrations: caching, cache invalidation, Kafka producers and consumers, async and scheduled jobs.

  1. Q71How does Spring caching work?
  2. Q72How do you integrate Redis?
  3. Q73How do you invalidate cached data?
  4. Q74How do you integrate Kafka?
  5. Q75What happens when Kafka processing fails?
  6. Q76How do you prevent duplicate consumption?
  7. Q77How does @Async work?
  8. Q78CompletableFuture vs reactive processing
  9. Q79How do scheduled tasks work?
  10. Q80How do you build reliable background jobs?
09Testing, Performance & MonitoringQ81–Q90 · 10 questionsAdvanced

Production readiness: test slices, Testcontainers, tuning slow APIs, WebFlux, Actuator and observability.

  1. Q81How do you write unit tests?
  2. Q82@SpringBootTest vs @WebMvcTest vs @DataJpaTest
  3. Q83How do you test REST APIs?
  4. Q84How does Testcontainers work?
  5. Q85How do you optimize slow APIs?
  6. Q86How does Spring handle concurrent requests?
  7. Q87Spring MVC vs WebFlux
  8. Q88What is Spring Boot Actuator?
  9. Q89How do you implement observability?
  10. Q90How do you debug memory leaks?
10Real-World Backend Interview ScenariosQ91–Q100 · 10 questionsScenario

Think like an SDE-2: reason through concurrency, payments, latency, scale and deployment problems out loud.

  1. Q91How do you prevent concurrent overselling?
  2. Q92How do you handle duplicate payment webhooks?
  3. Q93How would you debug a 5-second API?
  4. Q94Why might an application crash under load?
  5. Q95How do you process 1 million records?
  6. Q96How would you design secure refresh tokens?
  7. Q97How would you build a distributed rate limiter?
  8. Q98How do you handle database failures?
  9. Q99How do you deploy with zero downtime?
  10. Q100Explain a complete production backend request flow
Free sample

Read five answers from the book

The way every answer is written: a direct reply you can say in the interview, the detail behind it, and the follow-up to expect.

FundamentalsBeginner

What does @SpringBootApplication do?

Interview answer

It is a shortcut for three annotations. @SpringBootConfiguration marks the class as a source of bean definitions, @EnableAutoConfiguration loads the auto-configuration classes whose conditions match your classpath and properties, and @ComponentScan picks up your @Component, @Service, @Repository and @Controller classes from that package downwards.

  • Auto-configuration is conditional: @ConditionalOnClass, @ConditionalOnMissingBean
  • A bean you define yourself always wins over the auto-configured one
  • Run with --debug to print the condition evaluation report

Likely follow-up: How would you exclude one auto-configuration class, and why might you need to?

1 / 5
The big picture

Follow one request through a Spring Boot app

Most Spring questions are about one of these five steps. The book takes each one apart.

  1. filtersSecurity filter chain

    The JWT is validated and the SecurityContext is set before any controller runs.

  2. front controllerDispatcherServlet

    Finds the matching @RequestMapping handler and converts the JSON body into your DTO.

  3. @ValidController

    Validates input and delegates. Failures go to your @RestControllerAdvice.

  4. @TransactionalService proxy

    A proxy opens the transaction, calls your method, then commits or rolls back.

  5. JPARepository

    Spring Data builds the query; Hibernate tracks entities and flushes on commit.

Interview tip: most “why doesn’t my annotation work” questions come down to the proxy in step four. Chapter 05 covers proxies, self-invocation and propagation in depth.
Try it now

Five Spring Boot questions. How many can you get?

The kind of short checks interviewers use to test real understanding. Pick an answer to see the explanation.

Spring Boot quiz1/5

Which single annotation combines @Configuration, @EnableAutoConfiguration and @ComponentScan?

Learn by code

Spring code you can explain line by line

Patterns from the book that come up in almost every backend interview.

Constructor injection

Spring-managed dependencies, final fields and a service you can unit test without starting Spring. Chapter 02 explains why interviewers care.

  • Modern Spring Boot style
  • Explained step by step in the ebook
  • Includes the follow-up questions
BookService.java
@Service
public class BookService {

    private final BookRepository repository;

    public BookService(BookRepository repository) {
        this.repository = repository;
    }

    public List<Book> getBooks() {
        return repository.findAll();
    }
}
Production thinking

The scenarios that decide SDE-2 offers

Questions with no single right answer. The book shows how to reason through each one and which trade-offs to name.

  • Q91 · Concurrency

    Two users, one product

    Two requests try to buy the last item at the same time. How do you prevent overselling?

    @Lock(PESSIMISTIC_WRITE) · @Version
  • Q92 · Payments

    Duplicate payment webhook

    The gateway sends the same webhook twice. How do you make processing idempotent?

    unique event id + upsert
  • Q93 · Latency

    A 5-second API

    Is the time going to slow queries, an exhausted thread pool or a downstream call? How do you find out?

    Actuator · tracing · slow query log
  • Q94 · Load

    Crashes under traffic spikes

    What happens when request threads or database connections run out, and how do you protect the app?

    HikariCP pool · bulkhead
  • Q75 · Kafka

    Kafka consumer failures

    How should retries, dead-letter topics and duplicate events be handled safely?

    retry topic → DLT
  • Q99 · Deployment

    Zero-downtime deployment

    How do you roll out new code and database changes while staying available?

    rolling · readiness probes
Revision plan

Seven days to cover all 100 questions

One focused block a day. The question numbers tell you exactly what to read.

  1. Day 01Fundamentals and IoC

    Auto-configuration, starters, startup, DI, bean scopes and lifecycle.

    Ch 01–02 · Q1–Q20
  2. Day 02REST APIs

    Controllers, mappings, DTOs, validation, global errors, PUT vs PATCH.

    Ch 03 · Q21–Q30
  3. Day 03JPA and Hibernate

    Relationships, lazy loading, N+1, flush, JPQL and locking.

    Ch 04 · Q31–Q40
  4. Day 04Transactions and AOP

    Proxies, propagation, isolation, self-invocation and CGLIB.

    Ch 05 · Q41–Q50
  5. Day 05Security and microservices

    Filter chain, JWT, OAuth2, gateways, circuit breakers and sagas.

    Ch 06–07 · Q51–Q70
  6. Day 06Redis, Kafka and testing

    Caching, Kafka failures, @Async, test slices, Actuator and tracing.

    Ch 08–09 · Q71–Q90
  7. Day 07Scenarios and mock revision

    Work through all 10 production scenarios out loud, then re-read every answer you hesitated on.

    Ch 10 · Q91–Q100
Who it's for

Made for anyone with a Java backend interview coming up

  • Students and freshers

    Build a strong Spring Boot foundation before your first Java backend interview.

  • Java developers

    Move from Core Java to the Spring Boot round with the internals behind the annotations.

  • Backend engineers

    Strengthen your grasp of APIs, databases, security and production systems.

  • SDE-1 and SDE-2 candidates

    Prepare for theory, internals, implementation and scenario-based rounds.

What you get

  • 100 structured interview questions
  • Direct answers and detailed explanations
  • Java and Spring Boot code examples
  • Spring Core, IoC, DI and bean lifecycle
  • REST APIs and exception handling
  • Spring Data JPA and Hibernate
  • Transactions, locking and Spring AOP
  • Spring Security, JWT and OAuth2
  • Microservices and resilience patterns
  • Redis, Kafka and async processing
  • Testing, Actuator and observability
  • 10 real SDE-2 production scenarios
₹199₹39950% off
Questions

Before you buy

Anything else? Write to [email protected]

Is this Spring Boot book suitable for beginners?

Yes. It begins with Spring Framework and Spring Boot fundamentals, then moves to database integration, security, microservices and production scenarios. Basic Core Java knowledge is recommended before you start.

Which Spring Boot topics do the 100 questions cover?

Spring and Spring Boot fundamentals, IoC and dependency injection, REST APIs and exception handling, Spring Data JPA and Hibernate, transactions and AOP, Spring Security with JWT and OAuth2, microservices, Redis, Kafka and async processing, testing and monitoring, and real-world backend scenarios.

Does it include Java code examples?

Yes. Java and Spring Boot examples explain the key annotations, REST controllers, exception handling, JPA queries, transactions and locking, security, caching and other topics.

Is this useful for SDE-2 and experienced developer interviews?

Yes. The later chapters cover transactions, concurrency, Spring internals, microservices, Kafka, Redis, observability, and a full chapter of scenario questions such as overselling, duplicate webhooks, slow APIs and zero-downtime deployment.

How is this different from the HLD and LLD books?

HLD focuses on distributed architecture and scalability, and LLD on object-oriented class design. This handbook focuses on Spring Boot and Java backend interview questions. The LLD (Java) book is a good next step after it.

Is there a Java interview book too?

Yes. The Java Interview Handbook has 100 Core Java questions on OOP, Collections, Streams, concurrency, the JVM and modern Java. Both books are shown in the series section on this page.

Is this a complete Spring Boot development course?

No. It is built for technical interviews and revision. It explains concepts in depth, but it does not replace a full project-based development course.

How do I get the ebook after paying?

It is a digital PDF ebook. After your payment is confirmed you get access through Target Trek's ebook delivery flow, and you can read it on any phone, tablet or laptop.

Can I get a refund, and how do I contact support?

Digital purchases are non-refundable. For payment or access help, email [email protected].

Know what happens behind every annotation.

100 questions, 10 chapters, real Spring code and 10 production scenarios, in one PDF you can read anywhere.

₹199₹39950% off
Resume Lab by Target Trek

Applying everywhere but getting no interview calls?

Your book gets you ready for the interview. A better resume gets you the call. See exactly which lines cost you shortlists, and how to fix each one.

~2 min
AI report
Real people
review it
Pay once
no subscription
Master Springboot Interview
₹199₹39950% off