0 ratings 0% found this document useful (0 votes) 19 views 15 pages Java Spring Boot
The document is a comprehensive Java/Spring Boot interview preparation guide for 2025, outlining a structured study plan for beginners, intermediate, and advanced levels. It covers essential topics such as core Java fundamentals, Spring Boot basics, REST API development, advanced Java features, and microservices architecture, along with specific questions and concepts to master for each level. The guide emphasizes preparation timelines ranging from 2-3 weeks for beginners to over 6 weeks for advanced candidates.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here .
Available Formats
Download as PDF or read online on Scribd
Carousel Previous Carousel Next
Save Java Spring Boot For Later Complete Java/Spring Boot Interview
Preparation Guide 2025
(@ Study Plan Overview
© Beginner Level: 2-3 weeks preparation
© Intermediate Level: 3-4 weeks preparation
* Advanced Level: 4-6 weeks preparation
@ LEVEL 1: BEGINNER (0-2 Years Experience)
Core Java Fundamentals
Basic Concepts
What is the difference between JDK, JRE, and JVM?
What are the main features of Java (OOP principles)?
‘What are primitive data types in Java?
What is autoboxing and unboxing?
What are access modifiers in Java (private, protected, public, default)?
What is a package in Java?
What is a static keyword? Static variables and methods?
What is a Constructor in Java? Types of constructors?
Can we use static methods in a Constructor?
©PNOVseONna
OOP Concepts
10. What is inheritance? Types of inheritance in Java?
11, What is polymorphism? Give examples
12. What is encapsulation and abstraction?
13. What is method overloading vs method overriding?
14, When to use Interface vs Abstract Class?
15, What is a Marker Interface? Why use it?
String Handling
16. What is the difference between String, StringBuilder, and StringBuffer?
17. Difference between creating String with literal and new operator18, What is String pool and how does it work?
19. What are the advantages of String pool?
20. Why String is immutable?
Basic Collections
21. What is a Collection in Java?
22. Difference between Array and ArrayList?
23. What is the difference between ArrayList and LinkedList?
24, What is a HashMap? Basic operations?
25, What is the difference between HashSet and TreeSet?
26. What is an Iterator?
27. What is the difference between List and Set?
28. Array vs List
29, Set vs List
Exception Handling
30. What is an Exception? Types of exceptions?
31. What is the difference between checked and unchecked exceptions?
32. What is try-catch-finally block?
33, Can we use try without catch?
34, What is throw vs throws?
35. What are the use cases of creating user-defined exceptions?
36. How to handle user-defined exception?
37. What is a NullPointerException & how to prevent it?
38. What is a ClassCastException?
39, What is Error vs Exception?
Basic Control Structures
40. Explain the difference between break and continue statements
41. What is the difference between == and .equals()?
Spring Boot Basics
Core Concepts
42. What is Spring Boot?
43. What are the advantages of Spring Boot?
44, What is @SpringBootApplication annotation?
45. What is the difference between @Component, @Service, and @Repository?
46, What is dependency injection?
47. What is @Autowired?
48. What are Spring Boot starters?49.
50.
51.
‘What is application properties file?
Difference between Spring and Spring Boot?
‘What is IOC container in Spring?
REST API Basics
52.
53.
54.
55.
56.
57.
What is HTTP? Common HTTP methods?
What are HTTP status codes (200, 404, 500)?
What is REST API?
What is JSON?
What is @RestController vs @Controller?
What is the process of creating a REST API (with example)?
© LEVEL 2: INTERMEDIATE (2-4 Years Experience)
Advanced Core Java
Collections Deep Dive
58.
59,
60.
61
62.
63.
64,
65.
66.
67.
68.
69.
70.
Contract between hashCode() and equals() methods?
Explain the internal working of HashMap in Java
‘What happens on a HashMap collision?
- What is the load factor in HashMap?
Difference between HashMap, LinkedHashMap, and TreeMap?
Difference between HashMap, LinkedHashMap, and ConcurrentHashMap
How can you convert a HashMap into an ArrayList?
What are the differences between Comparable and Comparator?
‘What is a ConcurrentHashMap? How does it work?
What's the difference between Hashtable and ConcurrentHashMap?
‘What is the difference between Vector and ArrayList?
HashMap vs HashTable
ArrayList vs LinkedList
Java 8 Features
1
72.
73.
74,
75.
76.
77.
‘What is a Functional Interface?
Explain Java 8 features (Lambdas, Streams, Optional)
Difference between map() vs flatMap() in Java 8
What is Stream API and its advantages?
What is Stream pipeline?
Difference between intermediate and terminal operators in Stream API
Using Stream API, find the 2nd highest salary from employee objects list78. Use of Stream API in projects
79. Lambda expressions vs Anonymous classes
Advanced OOP
80. What is a Functional Interface?
81. What are Sealed Classes (Java 17)?
82. What is Fail Fast Iteration & how to handle it?
83. What is ConcurrentModificationException? Fail safe and fail fast iterators?
84, Final, finally and finalize()?
85. Autoboxing vs Unboxing
86. What is Cloneable? Deep clones vs shallow clones
87. Shallow Copy vs Deep Copy
Memory Management
88. Explain Java memory management
89, What is garbage collection in Java? Types of GC?
90. What is the finalize() method?
91. Stack vs Heap Memory Allocation
92. How to handle OutOfMemoryException?
Multithreading Basics
93, What is multithreading in Java? Thread lifecycle?
‘94. What is synchronization in Java? synchronized keyword?
95. What is the difference between wait() and sleep()?
96. What is the volatile keyword?
97. What is ThreadLocal?
98. What is a deadlock in Java? How can it be avoided?
99. Thread vs Runnable
100. Whatis the difference between Runnable and Callable?
101. Synchronized methods vs Synchronized blocks
Spring Boot Intermediate
‘Advanced Configuration
102. How does Spring Boot auto-configuration work?
103. Whats the role of @Configuration and @Bean?
104. How do profiles work in Spring Boot (@Profile use case)?
105. What is @Transactional, and what's the benefit?
106. How do you write a global exception handler in Spring Boot?
107. Difference between application properties and application yml?
108. Whats the use of CommandLineRunner and ApplicationRunner?109.
110,
m1
How does the embedded server (Tomcat) work in Spring Boot?
How do you override default auto-configurations?
How do you handle circular dependencies in Spring Boot?
Dependency Injection
112,
113,
114,
115,
116,
117,
What is constructor injection vs field injection vs setter injection?
What is @Qualifier and @Primary annotation?
If both @Qualifier and @Primary are used, which one will take precedence?
How to avoid bean creation failures in dependency injection?
@Autowired vs @Qualifier
@Primary vs @Qualifier
REST API Advanced
118,
119,
120.
121
122.
@RequestMapping vs @GetMapping
@PathVariable vs @RequestParam
@PostMapping vs @PutMapping
PUT vs PATCH
@ExceptionHandler vs @ControllerAdvice
Spring Boot Annotations
123,
124,
128.
126.
@ComponentScan vs @EnableAutoConfiguration
@Configuration vs @Bean
@Async vs @Scheduled
@Cacheable vs @CacheEvict
Database & JPA Basics
127.
128.
129,
130.
131
132,
133,
134,
136.
136.
What is ORM?
What is JPA? Difference between JPA and Hibernate?
What is an Entity in JPA?
What are JPA annotations (@Entity, @ld, @GeneratedValue)?
What is the difference between persist() and merge()?
What are JPA relationships (@OneToMany, @ManyToOne, etc.)?
What is JPQL?
What is lazy loading vs eager loading?
What is the difference between save() and saveAndFlush()?
In Hibernate, what is the difference between get() and load() methods?
Testing Basics
137,
138,
What is JUnit? Basic annotations?
What is @Mockito? When to use @Mock?139.
140.
141
What is the difference between @Mock, @MockBean, and @Spy?
How do you test REST controllers using MockMvc?
What is @SpringBootTest vs @WebMvcTest?
Security Basics
142.
143.
144,
145.
146.
What is Authentication vs Authorization?
What is Spring Security?
How do you secure REST APIs using Spring Security?
What is BasicAuth vs JWT?
What are HTTP status codes: 401, 403, 404, 500, 502, 5037
@ LEVEL 3: ADVANCED (4+ Years Experience)
JVM Internals & Performance
147.
148.
149.
150.
151
152,
153.
154,
156.
156,
How does the JVM work internally? (Class loader, memory areas, GC)
What are the different types of class loaders in Java?
What are strong, weak, soft, and phantom references in Java?
How does Java handle memory leaks despite having garbage collector?
What are different GC algorithms? When to use which?
How do you tune JVM performance?
What is JIT compilation?
What are JVM memory areas (Heap, Stack, Method Area, PC Register)?
What is metaspace in Java 8+?
How do you analyze heap dumps and thread dumps?
Advanced Concurrency
157.
158.
159.
160.
161
162.
163.
164.
166.
166.
167.
168.
169.
What is the Executor framework in Java?
What is a Future in Java?
What is a ThreadPool and why should you use it?
What are the real differences between ReentrantLock and synchronized?
How does volatile differ from synchronized?
What's the difference between thread safety and atomicity?
When would you use CountDownLatch vs CyclicBarrier?
What is the difference between busy-waiting vs blocking vs non-blocking calls?
How does CompletableFuture work internally?
How do you avoid thread starvation?
How would you write a thread-safe singleton?
What is the Producer-Consumer pattern? Implement with BlockingQueue?
What is ForkJoinPool and how it differs from regular thread pools?170.
1m
172,
173,
174.
How do Java Stream operations work internally (parallel vs sequential)?
What is a live-lock and how is it different from deadlock?
What is the Java Memory Model (JMM)?
How does a Semaphore work? Real-life examples?
What is a BlockingQueue? Types and use cases?
Advanced Spring Boot
175.
176.
17.
178.
179,
180.
181
182,
183.
184,
185.
186.
How does Spring manage bean lifecycle? What are the hooks?
What is a proxy in Spring? JDK vs CGLIB proxies?
What is the difference between @Autowired, @Inject, and @Resource?
Can you inject a prototype bean into a singleton? How?
What is the default scope of a bean in Spring?
How do you create custom auto-configuration?
What is Spring Boot Actuator? Important endpoints?
How do you implement custom health checks?
What is @ConditionalOnProperty, @ConditionalOnClass?
How do you implement custom metrics and monitoring?
What are the Scopes in Spring?
Prototype vs Request Scope?
Advanced AOP
187.
188.
189.
190.
191
192,
What is AOP and how is it implemented in Spring Boot?
Explain @Before, @After, @Around, @AfterRetuming, @AfterThrowing advices
What is a Pointcut and how do you define it?
What is a JoinPoint and what data can it provide?
How do you create custom annotations and intercept them using AOP?
Real-world use cases of AOP (logging, auditing, security, caching)
Advanced JPA & Database
193.
194.
196.
196.
197.
198.
199.
200.
201
202,
What is the N+1 select problem in JPA? How to fix it?
What are entity graphs and how do they help?
When would you use @Query vs derived queries vs Criteria API?
How does optimistic locking work in JPA? @Version annotation?
What is pessimistic locking? When to use it?
How do you handle pagination and sorting in Spring Data JPA?
What are database transactions? ACID properties?
What is connection pooling? HikariCP configuration?
How do you implement database migrations with Flyway/Liquibase?
What is database indexing? Query optimization strategies?
Advanced Spring Security203,
204.
205,
206,
207.
208.
209,
210,
2m
212,
213,
How do you implement OAuth2 and JWT in Spring Boot?
What is a stateless session? How does JWT help?
How do you implement two-factor authentication (2FA)?
How does CSRF protection work in Spring?
What is the difference between pre-auth and post-auth filters?
How does SecurityFilterChain work in Spring Boot 3+?
What is UserDetailsService and how do you implement it?
How do you implement role-based access control (RBAC)?
How do you implement method-level security?
How do you secure microservices communication?
How to implement OAuth authentication in Spring Boot?
Microservices Architecture
214.
215,
216,
217.
218.
219.
220,
221
222,
223,
224.
225,
226,
227.
228
229,
230,
What is the difference between monolithic and microservices architecture?
How do microservices communicate with each other?
What is RestTemplate? How to use it?
What is an API Gateway? Why is it used?
What is service discovery?
How do you implement resilience patterns (Retry, Circuit Breaker, Bulkhead)?
What is the Circuit Breaker pattern? Libraries like Hystrix/Resilience4j?
How do you implement API rate limiting?
What happens when one microservice becomes slow? Isolation strategies?
How do you handle versioning of REST APIs?
How do you implement distributed logging and tracing (ELK, Zipkin)?
What's the difference between sync and asyne communication?
What is eventual consistency? CAP theorem?
How do you implement saga pattern for distributed transactions?
How do you handle data consistency across microservices?
Microservices architecture vs Monolithic architecture
What is producer and consumer applications?
Apache Kafka
231
232.
233,
234,
235,
236,
237.
238,
239,
240,
What are the core components of Kafka?
What is a Partition in Kafka? How does partitioning work?
What is a Kafka Topic, Producer, Consumer?
What are Consumer Groups? How does rebalancing work?
What if a Kafka consumer keeps retrying endlessly? Dead letter queue?
How do you ensure message ordering in Kafka?
What is Kafka Connect? Use cases?
How do you handle exactly-once delivery semantics?
What is Kafka Streams? When to use it?
How do you monitor Kafka performance?241
Explain Kafka and how it handles real-time message processing
Advanced Testing
242.
243,
244,
245,
246.
247.
248.
249,
250.
What's the difference between unit, integration, and E2E testing?
How do you mock external REST APIs in tests?
What are TestContainers? How to use with Spring Boot?
How do you write parameterized tests in JUnit 5?
What is the role of @DataJpaTest, @WebMveTest, @SpringBootTest?
How do you implement test data builders and object mothers?
What is contract testing? Pact framework?
How do you implement performance testing?
What is mutation testing?
@ EXPERT LEVEL (5+ Years / Architect Level)
System Design & Architecture
251
252.
253.
254,
255,
256.
257.
258,
259,
260.
261.
How do you design a scalable e-commerce system?
How do you implement distributed caching (Redis, Hazelcast)?
What is CQRS pattern? When to use it?
How do you implement event sourcing?
What is database sharding? Strategies?
How do you design for high availability?
What is load balancing? Different strategies?
How do you implement API Gateway patterns?
What is strangler fig pattem for legacy system migration?
How do you design monitoring and alerting systems?
How does Redis caching work, and when should it be used?
DevOps & Cloud
262.
263,
264,
265,
266.
267.
268,
269,
270.
an
How do you containerize a Spring Boot app with Docker?
What is Docker compose? Multiestage Docker builds?
How do you create a Jenkins pipeline for Java apps?
What is the difference between blue-green and rolling deployments?
How do you implement zero-downtime deployment?
What is infrastructure as code? Terraform basics?
How do you handle secrets management (Vault, K8s secrets)?
What is monitoring and observability? Prometheus, Grafana setup?
JAR vs WAR files
Maven vs Gradle272.
Continuous Integration vs Continuous Deployment
Kubernetes & Cloud Native
273,
274,
275,
276,
277.
278.
279,
280,
281
282.
What is Kubernetes? Pods, Services, Deployments?
How do you deploy Spring Boot apps on Kubernetes?
What is a sidecar container? Use cases?
How do you handle configuration in K8s (ConfigMaps, Secrets)?
What is service mesh? Istio basics?
How do you implement autoscaling in K8s?
What is ingress controller?
How do you implement health checks in K8s?
What is Helm? Chart management?
Cloud-native pattems for Java applications?
Performance & Troubleshooting
283,
284,
285,
286.
287.
288,
289,
290,
291
292.
How do you profile Java applications?
How to debug memory leaks?
How to analyze thread dumps?
Gateway Timeout vs Service Unavailable - troubleshooting?
How do you optimize database queries?
How to handle high GPU usage in production?
What tools do you use for application monitoring?
How do you implement distributed tracing?
Service Not Found — how to troubleshoot?
How to debug locally & remotely?
© MODERN JAVA FEATURES (2024-2025)
Java 21+ Features
293,
294,
295,
296,
297.
298,
299,
300,
What are Virtual Threads vs Platform Threads?
How do Virtual Threads improve performance in /]O-heavy applications?
When should you NOT use Virtual Threads?
How to create Virtual Threads using Executors. newVirtualThreadPerTaskExecutor()?
How do Record Patterns simplify switch expressions?
What are the benefits of pattern matching for instanceof?
What are getFirst() and getLast() methods in collections?
How do String Templates improve string building over concatenation?Reactive Programming
301. What is reactive programming?
302, Difference between Mono and Flux?
303. How to handle backpressure in reactive streams?
304. When to use reactive vs traditional Spring MVC?
305. How to chain multiple asynchronous operations with CompletableFuture?
306. Reactive programming vs Imperative programming
» SCENARIO-BASED QUESTIONS
Performance Issues
307. Your Spring Boot application takes 45 seconds to start up in production, but only 5
seconds locally. How do you investigate?
308. After deploying to production, your REST APIS are responding in 5+ seconds. What's
your debugging approach?
309, Your application works fine with 100 users but crashes with OutOfMemoryError with
1000 users. How do you solve this?
310. Your microservice occasionally returns 503 Service Unavailable during peak traffic.
‘What could cause this?
Security Scenarios
311. Users get logged out every 30 minutes despite JWT tokens being valid for 24 hours.
What's happening?
312, Your API is being hit by 10,000 requests per second from the same IP. How do you
implement rate limiting?
313. You need to implement SSO for 20 different applications. How do you design this?
Database Issues
314, Your e-commerce app takes 30 seconds to load product catalog with 10,000
products. How do you optimize?
315. You're getting 'LazylnitializationException’ in production but not in tests. Why and
how do you fix it?
316. Two users are trying to update the same product simultaneously. How do you handle
this?
Microservices Challenges317. You need to migrate a monolithic application with 2 million users to microservices.
What's your strategy?
318. Service A depends on Service B, which depends on Service C. Service C is down.
How do you prevent cascade failures?
319. You have an order that touches 5 different microservices. If one fails after others
succeed, how do you handle this?
©» BEHAVIORAL & LEADERSHIP QUESTIONS
Technical Leadership
320. How do you evaluate new technologies for adoption?
321. Describe your approach to technical debt management
322, How do you handle disagreements in technical design?
323. What's your strategy for mentoring junior developers?
Problem Solving
324. Describe a complex technical problem you solved
325. How did your technical decisions impact business metrics?
326. Describe a time you prevented a major production issue
327. How do you prioritize technical improvements vs new features?
Communication & Collaboration
328. How do you explain technical concepts to non-technical stakeholders?
329. Describe a time you had to work with a difficult team member
330. How do you handle pressure and tight deadlines?
x PREPARATION STRATEGY
Week 1-2: Core Java Mastery
Focus on questions 1-100
Practice basic coding problems
Understand OOP principles thoroughly
Master collections and exception handling
Week 3-4: Spring Boot Deep DiveFocus on questions 101-200
Build sample REST APIs
Practice dependency injection scenarios
Understand Spring Security basics
Week 5-6: Advanced Concepts
Focus on questions 201-300
Study system design patterns
Practice microservices scenarios
Leam performance optimization
Week 7-8: Modern Features & Practice
Study Java 21+ features
Practice scenario-based questions
Mock interviews with peers
Review real project experiences
Final Week: Integration & Review
Practice all levels together
Focus on weak areas
Prepare STAR format answers for behavioral questions
Review company-specific requirements
«ul QUICK REFERENCE CHARTS
Key Annotations Comparison
Annotation Purpose Scope
@Component Generic Class level
stereotype
@Service Business logic Class level
@Repository Data access Class level
@Controller Web requests Class level
@RestController. REST APIs Class levelHTTP
Code
200
201
400
401
403
404
500
Status Codes
Meaning When to Use
OK Successful request
Created Resource created
Bad Request Invalid input
Unauthorized Authentication required
Forbidden Access denied
Not Found Resource doesn't exist
Intemal Server Error Server-side error
Collection Performance
Operation ArrayList LinkedList HashMap
‘Add Ot) (1), (1)
Get (1) O(n) out)
Remove O(n) o(t) 1)
Search O(n) O(n) (1)
\ FINAL TIPS
Before Interview
Rene
Research the company's tech stack
Prepare 2-3 detailed project examples
Practice coding on whiteboard/shared screen
Review recent Java/Spring releases
During Interview
Pers
Think out loud while solving problems
Ask clarifying questions
Explain trade-offs and altematives
Show willingness to learnAfter Interview
1, Send thank you email within 24 hours
2, Address any gaps from the interview
3. Follow up professionally
Good luck with your interview preparation!
Remember: Consistent practice and understanding concepts deeply is more important than
memorizing answers,