Spring Boot Developer Interview Questions & Answers
40 questions for Spring Boot Developer interviews — 5 easy, 29 medium, 6 hard.
About the Spring Boot Developer role
A Spring Boot developer specialises in building microservices with the Spring ecosystem: Spring MVC, Spring Data, Spring Security and Spring Cloud. Daily work includes configuring services, securing APIs with JWT or OAuth2, adding observability with Actuator and Micrometer, and shipping through Docker and CI/CD pipelines. Companies moving from monoliths to microservices hire heavily for this role. Strong debugging habits and clear documentation are valued in this role.
A @Transactional method is not rolling back after an exception. What could be wrong?
Show answer
Map a one-to-many relation between Order and OrderItem in JPA.
Show answer
Describe a time you had to learn a new technology quickly.
Show answer
An API listing 100 orders fires 101 SQL queries. How do you fix it?
Show answer
Users get LazyInitializationException when the API returns an entity. What is happening?
Show answer
You must expose configuration that differs between dev, QA and production. How do you manage it?
Show answer
What is the difference between synchronized and ReentrantLock?
Show answer
Why should we hire you as a Java backend developer?
Show answer
Why is PreparedStatement preferred over Statement?
Show answer
Clients report duplicate orders when they retry after a timeout. How do you prevent it?
Show answer
What is dependency injection and why is constructor injection preferred?
Show answer
A counter shared between threads shows wrong totals. How do you fix it?
Show answer
What are virtual threads and when should you use them?
Show answer
A stream pipeline that updates a shared ArrayList in forEach gives random results with parallel(). Why?
Show answer
How does ExecutorService work and why use a thread pool?
Show answer
Write a simple REST controller in Spring Boot for creating and fetching products.
Show answer
Explain the entity lifecycle states in JPA.
Show answer
What is a deadlock and how can it be prevented?
Show answer
Your Spring Boot service takes 40 seconds to start in Kubernetes and pods get killed. How do you fix it?
Show answer
Write a Spring Data JPA repository method that fetches orders with items to avoid N+1.
Show answer
How do you mentor junior developers on your team?
Show answer
Tell me about a microservice you designed end to end.
Show answer
How does Spring Boot auto-configuration work?
Show answer
How would you write a simple thread safe rate limiter in Java?
Show answer
How do you take a thread dump and a heap dump of a running Java process?
Show answer
Write a JDBC batch insert for a list of products.
Show answer
Run two tasks in parallel with CompletableFuture and combine their results.
Show answer
Two scheduled jobs on different servers process the same records twice. How do you prevent this?
Show answer
What is the difference between @Component, @Service, @Repository and @Controller?
Show answer
What is the N+1 select problem in Hibernate and how do you fix it?
Show answer
How would you split a monolith into microservices?
Show answer
Write a unit test for a service class using JUnit 5 and Mockito.
Show answer
What is the difference between lazy and eager loading?
Show answer
Explain bean scopes in Spring.
Show answer
Bind typed configuration properties with validation in Spring Boot.
Show answer
What is exception chaining?
Show answer
Write a JPQL query that returns a DTO projection instead of entities.
Show answer
Implement a producer-consumer using BlockingQueue.
Show answer
What does the volatile keyword guarantee?
Show answer
Frequently asked questions
What does a Spring Boot Developer do?
A Spring Boot developer specialises in building microservices with the Spring ecosystem: Spring MVC, Spring Data, Spring Security and Spring Cloud. Daily work includes configuring services, securing APIs with JWT or OAuth2, adding observability with Actuator and Micrometer, and shipping through Docker and CI/CD pipelines. Companies moving from monoliths to microservices hire heavily for this role. Strong debugging habits and clear documentation are valued in this role.
Which skills are tested in a Spring Boot Developer interview?
Expect questions on Spring Boot, Spring Security, Microservices, Docker, Kafka. Most rounds also ask you to explain a project and solve one practical problem live.
How do I prepare for a Spring Boot Developer interview?
Revise Spring Boot and Microservices, JDBC, Hibernate and JPA, Multithreading and Concurrency first using the topic sheets, practise the questions on this page aloud, then do one full mock interview to practise timing.