Springsaver
Springsaver
This ebook is protected by copyright law. The content within is intended specifically for students and
working professionals to enhance their learning and professional growth. Unauthorized use of this
material for monetary gain, reproduction, distribution, or any other commercial purpose is strictly
prohibited. Any attempt to exploit this content in such a manner is a violation of copyright law and will be
subject to legal action.
Portfolio : https://www.amiteshkumar.in/
Topmate : https://topmate.io/amitesh_kumar_ray
LinkedIn : https://www.linkedin.com/in/amitesh-kumar-ray/
Disclaimer: The information provided in this ebook is for general informational purposes only and should
not be considered as professional, legal, or financial advice. The author and publisher disclaim any
liability or responsibility for any loss or damage incurred as a consequence of the use of the information
presented in this book.
First Edition
About the Author
His technical expertise spans Java, Spring Boot, Microservices, AWS, Kafka, Python,
AI, and Machine Learning, making him a sought-after mentor and industry expert.
A passionate contributor to the developer community, Amitesh has authored 15+ books
on Java, Spring Boot, and Microservices, empowering developers with in-depth
knowledge. With a keen focus on technical excellence, he has conducted over 500
technical interviews in the past 4-5 years, helping organizations identify top engineering
talent.
Warm regards,
Overview
Each question in this book has been carefully selected, reviewed, and
refined by industry experts to ensure relevance and depth. Whether you're
preparing for your first job or aiming for a senior position, this resource
will help you build confidence and excel in your interview journey.
These questions cover widely used Java concepts, making them an essential
practice tool for interview preparation. I hope this book becomes a valuable
companion as you advance in your Java development career.
Who This Book Is For ?
This book is designed for any engineering student or working professional aspiring
to secure a Java developer role. Whether you're just starting your career or have up
to 15 years of experience, this book will serve as a valuable resource. It contains
some of the most commonly asked interview questions, providing you with the
insights and preparation you need to confidently tackle technical interviews at all
stages of your career.
If you're looking to sharpen your skills, improve your understanding of Java, and
stand out in job interviews, this book is a perfect fit for you.
Springboot:
1. What are the most common annotations you have used in your application
2. How does the bean lifecycle work? Explain all
3. What is profile and how does it help
4. How to keep database creds in spring application
5. You have 4 environments for application ,how do you manage configurations for each
environment.
6. Why does the Rest API returns result in json only ? what if i want xml
7. What are the conditional annotations in spring and how does it help, tell me the use case
you have in your application.
8. How do you map your request data to entities while saving to DB ? What kind of mapper
are you using for it?
9. How do you handle exceptions in springboot ?
10.How do you create your own exception ? and how do you handle global exception
handling ?
11.How does autoconfiguration help developers ?
12.What if I want to perform some acting right after the spring container is initialized ? How
do we do it ? and why it's needed ,tell me some use cases if you have done in your
application.
13.What is @Qualifier and how does it help?
14.Can you tell me how your request reaches your Rest Controller ?
15.Tell me some spring cloud components that you have used in your application.
16.How to achieve security using spring boot.
17.How to secure data over the network
18.Using stream api fetch emp record based on their department. <emp_dept, list<emp>>
19.What is blackduck?
20.Can we have a prototype bean inside a singleton bean in spring boot?
21.Type of vulnerability faced in project
22.Non functional required you will ask before start working on any project
23.How do you handle exception in your Springboot app
24.How to implement global exception handling in Springboot microservice?
25.How to handle exceptions using AspectJ ? explain in detail
26.How to enable distributed logging for your microservices? What are the tools you have
ever used?
Spring Security
27.What is the best way to call an API from another service ? What are the steps you need
to take care of while you are integrating your service to external and internal services ?
Do you see any security steps you need to take care about ?
28.How have you leveraged OAuth2 in your application ?
29.How are you getting auth token from auth server and how does it get refreshed?
30.Explain the grant type with the use cases that you have used in your application.
31.How does the resource server verify your token ? does it hit the auth server all the time
for each request ? How can you optimize this behavior ?
32.How to avoid users to use the most commonly used password in springboot ? Do you
see any library or any other option to do it ?
33.Can you explain to me the Auth flow in springboot ? assume you are calling some API
then how your request will proceed and you get a response ?
34.How springboot remember you if you call some APIs 2nd time ,does it do all auth steps
again ?
35.How can you implement your own auth provider ?
36.What auth server you are using and how you are validating users? What if I want my
resources to be protected ? How will you do it?
37.Explain the difference between Authentication and Authorization in Spring
Security.
38.What is the role of the UserDetailsService interface in Spring Security?
39.How do you implement custom authentication in Spring Security?
40.What is a SecurityContext, and how does it work in Spring Security?
41.How do you secure a REST API using Spring Security?
42.What are the differences between Role-based and Permission-based access
control in Spring Security?
43.How does Spring Security support OAuth2 and OpenID Connect for authentication?
44.Explain how to implement method-level security using @PreAuthorize and @Secured
annotations.
45.What is the role of Spring Boot Actuator, and how can it be used for monitoring and
management in a microservices architecture?
46.How do you configure security in a Spring Boot application without using Spring
Security's default configuration?
47.Explain how Spring Boot integrates with external configuration sources, such as
databases or cloud configuration services.
48.How does Spring Boot manage transactions, and what are the different propagation and
isolation levels you can configure?
49.What are the benefits and challenges of using Spring Boot with a reactive stack (e.g.,
WebFlux) compared to traditional MVC?
50.How do you implement and configure a custom filter or interceptor in a Spring Boot
application?
51.Explain the purpose of Spring Boot @Conditional annotations and how you can create
custom conditions for auto-configuration.
52.How do you document your Rest API ?
53.How to handle input validation in spring ? What are the possible ways and which one is
the best?
54.How do you document your Rest APIs ?
55.How to enable security for Swagger docs ?
56.What is JWT ?
57.What is OAuth2.0 and how you have used it in your project.
58.How you have handle security for service-to-service communication
59.What are the Grant Types in OAuth2 , explain the use case for each grant type I should
go for.
60.How are you handling Authentication and Authorization in your application ? what are
the Auth servers you have ever used in your application.
61.What is OIDC and what does it do? Have you used it in your application ? If yes,tell me
the flow.
62.What is LDAP and how can you integrate it with your Auth server?
63.How are you securing your resources in your microservice architecture ? what are the
possible way to secure the resources in Springboot.
64.What are the possible ways to keep a logged-in user logged-in ? How do you manage
the session for your Auth token ?
65.How to avoid accepting the most commonly used password as password. For example i
don't want my application to accept Test@123 or Test123, abc1234 or any similar String
that are most widely used or very simple to guess
SpringData:
Scenario based questions
196. I have a list of 10K employee data. I want to perform some data transformation and
filtration ,duplicate and want data in sorted order , how do you handle it ?
197. I have a list of Employees. How to avoid duplicates?
198. Assume you are making a REST Api call from one service to another service. How
will you manage data security and what are possible ways to make remote calls?
199. You are calling one service from another , what if the remote service went down OR
not responding?
200. I am getting millions of requests in a second through the REST APi, how to handle it
safely to avoid any data loss.
201. How you can enable distributed tracing in your microservice architecture.
202. Suppose you are going to design your microservice architecture, what are the
common cross cutting concerns you will implement and how. What tools you will use for
the same.
203. Suppose you have 20+ microservices, how do you maintain the runtime parameters
like DB details and some other global configurations? What is the best way to handle
such use-cases?
204. What is config server and config map and why do we use them in microservices?
KAFKA:
205. What is Apache Kafka, and what are its core components?
206. What is Kafka Connect, and how is it used for integrating with external systems?
207. What is log compaction in Kafka, and when would you use it?
208. Explain the difference between a topic, partition, and segment.
209. What are Kafka consumer groups, and how do they affect message consumption?
210. How does Kafka ensure message ordering?
211. How does Kafka ensure high throughput and scalability?
212. What is a consumer group in Kafka?
213. How do you achieve exactly-once semantics (EOS) in Kafka?
214. What is Kafka's replication factor, and why is it important?
215. How does Kafka achieve fault tolerance?
216. How do Kafka producers handle retries and failures?
217. Explain Kafka's partitioning strategy and how it impacts performance.
218. What is Kafka retention policy, and how does it work?
219. Describe Kafka's consumer offset management.
220. How can Kafka handle back-pressure in real-time data processing?
221. Explain the concept of exactly-once semantics (EOS) in Kafka.
222. How would you monitor and optimize Kafka performance in a production environment?
223. Describe how Kafka handles leader election for partitions.
224. What are the challenges of using Kafka in a multi-datacenter setup?
225. How does Kafka handle fault tolerance at the broker level?
226. How would you design a Kafka-based system to guarantee data consistency in the event
of node failures?
227. What are the possible ways to tune kafka ?
228. How to ensure that KAFKA consumers will not consume duplicate data ?
229. What are the kafka publishing strategies ?
230. What are the strategies for partitioning ?
231. Implement your own Kafka using multi-threading.
232. What serializers are required ? How can you customize the behavior ?
233. What are Kafka quotas, and how can they be used to prevent resource contention?
234. How can you track data loss in kafka ? any tool you have used for it ?
235. Why do you need Kafka? How can you design your kafka ? tell me the best practices
236. What if your zookeeper went down? Can you avoid zookeeper in kafka configuration ? Do
you see any difference between zookeeper and Kraft ?
237. How to make your kafka concurrent ?
238. What is kafka offset reset and how can you customize its behavior ?
239. Can multiple kafka consumers poll data from the same topic partition ? How does kafka
ensure ordering of msgs in partitions ?
240. How does Kafka handle message durability?
241. What is Kafka's ISR (In-Sync Replicas), and how does it work?
242. What are common challenges in scaling a Kafka cluster, and how do you handle them?
System Design:
243. I want to design an Amazon-like service where you can place your order as a customer and I
can check the inventory in the support system.how will you design the system ? can you generate
pattern specific random id for order id where order id should be justifying the order location,zone
and user type.
244. Design Phone system where you have to do transactions to the user,partner and RBI. User
transaction should be done on fly ,third party partner transaction should be done 15 days and RBI
transaction should be done on scheduled configuration time. Design the e2e system and draw
architecture diagrams.
245. Design a system to take care of money transfer from one account to thousands of accounts at
the same time , how will you handle failure ?
246. You have 50+ microservices in env ,how can you design a fault tolerant system with
negligible failure ? How will you establish communication with internal and external systems ?
How can you design an efficient data access layer ? How will you define security and logging ?
NOTE: he wants you to design a system like real time.
247. How do you manage data consistency in a distributed microservices architecture? Design the
system flow and architecture with UML diagrams.
248. How do you design a scalable and fault tolerance system using microservices ?
249. How would you handle API versioning and backward compatibility in microservices ?
250. How do you design cross-cutting concerns in microservice architecture ? list them and
explain them on a high level. Design a stable ecommerce system considering the industry best
practices.
251. How would you handle database design in a microservices architecture? Suppose you have a
monolithic ecommerce system , how you can convert to microservice based architecture , what
DB you prefer and why ? list the strategies to enable fast access of data from DB. How will you
integrate your new system ? Design the system architecture and data flow.
252. What are the spring-cloud components you have used in your current application ? How can
you manage auditing in ms architecture ?
253. What are the microservice design patterns you have used so far ? explain it on a high level
with use-case as per your current project.
254. What is ACID ? explain in detail with a use case if you have used it in your application.
255. What are SOLID principles ? Why do we need it ? explain in detail with realtime examples.
256. What are the design patterns you have used so far in your application? Tell me the use-case
where you have used it.
257. List some of the design patterns you have used in your microservice based architecture.
258. What is SAGA ? When will you go for it? And when to go for a 2 phase commit?
259. Can a real time event processing system and draw the architecture.
260. Design a simple chat application.
261. What are some key points you think while designing the services with multiple components?
262. What are cross cutting concerns ? list some of them and how you implement them.
263. What is separation of concerns ? What are the benefits of it and how do you do it ?
264. You have got a new project to implement , how do you start it, what is the best way to
proceed?
265. What is code smells and what are some best practices you follow while coding.
266. You have got a new project where you have to start it from scratch , as a Lead/Architect how
will you proceed ? What are the steps and processes you will follow?
267. What is system design and what are some best practices while doing system design?
268. What is the CAP theorem?