This video presents real Java Spring Boot interview questions from a recent Accenture interview, covering essential topics including thread-safe collections (HashMap vs ConcurrentHashMap), proper hashCode/equals implementation, Spring Boot auto-configuration, immutable objects, thread-safe singleton patterns, list implementations (ArrayList vs LinkedList), exception handling with @ControllerAdvice, Spring bean types (Component, Service, Repository), JVM memory management, checked vs unchecked exceptions, @Transactional annotation, microservices architecture, REST API security with Spring Security and JWT, final/finally/finalize differences, garbage collection, functional interfaces and Stream API, synchronization mechanisms (synchronized vs volatile), pagination with Pageable, dependency injection, REST vs SOAP web services, concurrency handling, SQL joins, query optimization, PUT vs POST methods, @Qualifier annotation, Spring bean lifecycle, @RequestParam vs @PathVariable, null handling with Optional class, and ExecutorService for thread management.
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
Accenture Asked These Brutal Spring Boot Interview Questions RecentlyAdded:
Hi guys, welcome back to my channel Java interview buddy. So in this video I'm going to share some real interview questions shared by one of our subscriber. Her name is Pooja Singh. So Pooja recently faced an interview at Accenture and she has around 3.1 years of experience. She shared all the questions with us. In this video I will go through each question one by one and explain them in a simple way. And also guys, if you faced any interviews recently, please share your questions with us. You can fill out the form in the description below. All right, so now let's start the video. So the interview started with the question can you explain the difference between hash map and concurrent hash map? See, both are used for key value storage, but the major difference is thread safety. Hash map is not thread safe. So if multiple threads access it, you can get data inconsistency. Now concurrent hash map is designed for concurrency. It allows multiple threads to read and write safely. Internally it uses segment level locking for CAS. So performance is better than synchronized map. So honestly, in multi-threaded application you should always prefer concurrent hash map. By the way guys, questions like these are already available in my interview question kit. If you want that, you can check in the description.
All right. So next the interviewer moved to the next question. What happen if you do not override the hash code and equals method properly? So this is very important and very, very common question guys. So [snorts] this is critical when using collections like hash map or hash set. These collection depends on the hash code for bucket placement and equals for comparison. If not implemented properly, you may get duplicate objects or unable to retrieve data even if logically equal. So consistency So consistency between hash code and equals is important. And honestly, this is very common mistake people usually do. So now let's move to the next question. How does Spring Boot auto configuration works internally?
Spring Boot uses enable auto configuration annotation, which loads configuration automatically. Based on the class path, it checks dependencies and then applies configuration using conditional annotation like conditional on class annotation. So if a dependency is present, corresponding config is loaded. Internally, spring.factories or metadata files are used. So, basically, it reduces manual configuration. Moving to the next question, can you explain the concept of immutability in Java? So, immutability means object states cannot change after creation, like string. Once created, you cannot modify it. Instead, a new object is created. This makes code thread safe because no one can change shared data. To create immutable class, make fields final, no setters, and defensive copies. Honestly, this is very useful in multi-threaded application.
Moving to our next question, so in this question, we need to create a singleton class in Java, but not [snorts] just a normal singleton. We need to make it thread safe as well. So, this is important because in multi-threaded environment, multiple threads may try to create the objects at the same time. So, first, I will create a class. I will name it singleton. So, here I have a singleton class. The goal of singleton is to allow only one object of this class in the entire application. So, that's why I will make the constructor private. So, I will create a constructor which is private. Now, why I created a private singleton constructor? Because if the constructor is public, any other class can create object using new, and that breaks the singleton concept. So, this private constructor means object creation is restricted inside the same class only.
Now, what I will do, I am creating a static reference. I will say private static singleton instance. All right, so I have created a static reference variable of the same class. This variable will hold the only object of the singleton class. Now, we use static because the object should belongs to the class, not to the individual objects. Now, I will create a public method. I'm writing a public method, public static method. I will call this method get instance, and this will return singleton. All right, So, this method will check whether the object is already created or not. For that purpose, in the inside this method, I will put a condition, a if block. I will check the instance is null or not. If instance is null, then I will assign a new object to it. That means if object is already not created, it creates a new object. Otherwise, we will return the existing object. So, I will say return instance. So, this works fine in a single-threaded environment.
But, this is not thread-safe. So, now let's understand the problem. Suppose two threads enter this method at the same time. Both threads may see that instance is null, and both may create a separate objects. That means singleton breaks. So, to make this thread-safe, I can add synchronized to this get instance method. So, here I will say synchronized. Now, only one thread can enter this method. This solves the thread safety issue, but it has a performance cost because synchronization happens every time even after the instance is already created. So, the better approach would be double-checked locking. In this if condition, I'm checking if instance is null without synchronization. Only if it is null, then it enters the synchronized block. So, I will create a synchronized block, and inside that synchronized block, I will check if instance is null, then instance is equal to new singleton.
So, inside this block, it checks again and creates the object. And this improves performance because synchronization is used only during the first time object creation, not on the every method call. So, this is how we implement a thread-safe singleton class in Java. Moving to our next question, what is the difference between array list and linked list? See, both are list implementation, but internally array list uses dynamic array. Linked list uses doubly linked list. So, accessing element is fast in array list because of the indexes, but insertion or deletion in the middle is very costly. Now, linked list is opposite. Insertion and deletion is faster, but access is slower because it has to traverse. And in most cases, array list is preferred. Now, the next question is, how do you handle exception in Spring Boot application?
So, in Spring Boot, you don't handle exception everywhere manually. Instead, you use global exception handling with controller advice annotation and exceptional handle annotation. This helps you centralize logic. Also, you can return proper error messages with status code. And this keeps code clean and consistent. Now, quickly moving to our next question, what is the difference between component, service, and repository? This question is asked in multiple interviews, and it is very easy as well. So, all three are used for the bean creation, but they have different purpose. For example, component is a generic one. Service is for business logic and repository are for a database layer. Also, repository provide exceptional exception translation. So, database exceptions are converted, and functionally they are all similar, but it is used for the clarity and structure. Now, let's move to the next question, how does the JVM manage memory? JVM divides memory into different areas like heap, stack, memory areas. Heap store objects, stack store method calls and local variable. And now, garbage collector. Garbage collector cleans unused objects automatically. You should know basic flow, not deep internal, but basic flow you should know. Now, the next question is, what is the difference between checked and unchecked exception? Checked exceptions are checked at compile time.
You must handle them like IO exception.
Unchecked exceptions are run time like null pointer exception. No need to handle explicitly. And checked exceptions are expected scenario means on the other hand, unchecked exceptions are like programming errors. Now, they went little deeper and asked some questions in the transactional annotation, microservices. So, the next question is how does the transactional annotation works in Spring? Okay, so transactional annotation manages transaction. So, when method starts, transaction begins. If method completes successfully, commit happens. If exception occurs, then rollback happens.
Now, internally Spring uses proxies. So, method calls are intercept and transaction logic is applied. And honestly, self-invocation does not work because proxies bypass in that case. And in this video, because many questions are repeated, so I hope you are watching other of my videos. So, I'm going surface level only on the questions. If you want little deeper on every question, I can do that as well. You can mention that in comment if you want that. All right, so let's move to the next question. What are the advantages of using microservice architecture? See, microservices allowed independent services. So, each service can be deployed separately. Scaling is easier in that case because you can scale only required service. Also, teams can work independently, but honestly, it adds complexity like like communication, monitoring. So, use it when it is very needed. Now, before going to our next question, I want to quickly remind you that if you face any interviews recently, please share your questions with us. You can fill out the form in the description. And for the mock interviews as well, I have mentioned a form in the description. All right.
Uh so, moving back to our next question.
How do you secure REST APIs in Spring Boot? See, security is critical in real applications. First thing, you use Spring Security for authentication and authorization. You can implement JWT.
So, every request carries token and server validates. Also, you can use OAuth2 for third-party authentication.
Then, role-based access control to restrict endpoints. And never expose APIs without security. That is the main rule. The next question is what is the difference between final, finally, and finalize? Okay, these three are completely different things. Final is a keyword. It is used for variable, methods, and class. It is means cannot change. Finally is block used in exception handling, and it always execute. And finalize is a method. It is used in garbage collector before object is destroyed. So, finalize is deprecated now, so it is rarely used. So, I have mentioned all the major points in this answer. Now, let's move to the next question. How does garbage collection works in Java?
See, garbage collector removes unused object from heap memory when objects are no longer referred. So, [snorts] they become eligible for garbage collection, and GC identify them and freeze memory.
Now, different algorithm exists for this like GC1, GGC, but you don't control GC manually. So, just ensure no memory risk by avoiding unnecessary reference. Let's move to the next question now. What are the functional interfaces in Java 8? So, you need to mention few of the functional interfaces in this answer.
So, basically, functional interface has only one abstract method that is required for lambda expressions like runnable or comparator. It can have default method, but only one single abstract method. So, lambda can be used.
And this is core concept for streams and functional programming. Now, the next question is very important. How does the stream API works in Java? So, see, stream API processes data in a functional style. You can create stream for from collection, then apply operations like filter, map, and finally terminate operation collect. Now, stream does not store data. It processes like a pipeline, and it evaluate data lazily. That makes it efficient. Now, the next question is from synchronization. What is the difference between synchronized and volatile? So, first, synchronize.
Synchronize provide locking. So, only one thread executes that block, which ensure mutual execution. And volatile [snorts] on the other hand, it ensure visibility. So, no locking is there.
That means updates are visible to everyone, but no it is not atomic. And it is used for the synchronized operation. So, synchronized is for operations, but volatile is for simple flags. All right. So, the next question is how do you implement pagination in Spring Boot? See, pagination is done using pageable. So, in Spring Data JPA, you pass page number and size.
Repository returns page object. So, internally SQL limits and offset are applied. And always use pagination whenever required for large data set to avoid performance issue in the future.
All right. Next question is what is dependency injection and why it is important? See, dependency injection means objects are not created manually.
Instead, they are provided by framework like Spring. So, you don't use new keyword everywhere. Spring creates beans and inject dependencies. Now, why it is important? It reduces coupling. That makes code more flexible and easier to test. And this is very core concept of Spring. Now, the next question is what is the difference between REST and SOAP web services? So, nowadays REST is mostly used, but if you are familiar with the SOAP as well, you will be able to answer this question. So, I will talk about both of them. REST is basically REST is lightweight. It uses HTTP method like GET, POST. And it works with JSON.
Now, coming to SOAP, SOAP is a protocol-based. Like it uses XML and it has strict structure. REST is faster and widely used. SOAP is more secured and used in the enterprise application. And more but most modern application uses REST. Now, the next question is how do you handle concurrency issues in Java?
See, concurrency issues happens when multiple threads access shared data.
So, you use synchronization, locks, or concurrent collection like concurrent hash map. Also, atomic classes like atomic integer, which helps in safe updates. Honestly, avoid shared state whenever it is possible. Now, the next question is from SQL. What are the different types of joins in SQL? Okay, so joins are used to combine tables. Like, there are inner joins, which returns matching records, then left outer joins, then left joins, which returns all from the left and matched from the right. Then right join, which is opposite of that. Then full join, which returns all the records from both sides. And inner join and left join are most commonly used in general cases.
Then we come to our next question. How do you optimize a slow-running query? See, first step is to identify the problem using execution plan. Then check indexing. Add indexes if missing. Also, avoid unnecessary joins and select only required columns. Sometime, caching also help in this case. So, optimize at DB level, not just the code level. Now, the question is, what is the difference between put and post method in REST?
Post is used to create resources, and it is not idempotent. Means, calling multiple times create multiple entries.
Put is used to update, and it is idempotent, which means calling multiple times create the same result. Update the same result, basically. So, the difference is very important whenever you are designing the APIs. Now, the next question is, what is the use of qualifier annotation in Spring? See, qualifier annotation is used to resolve ambiguity when multiple beans exist of the same type. So, you specify which bean to inject along with autowire annotation, and it avoids no unique bean definition exception. All right. So, I hope you got the idea how to answer these type of questions in the interviews. Now, moving to the next question. How does Spring handle bean life cycle? See, Spring manages bean life cycle completely. First, bean is initialized, then dependencies are injected, and after that, initialization happens, like using the post construct annotation. Then a bean is ready to use.
When application shut down, destroy method is called like pre-destroy annotation. So, understanding life cycle will help you to debug and customization in future of the application. Now, what is the difference between request param annotation and path variable annotation?
Okay, so request param annotation is used to get the values from query parameters like ID is equal to 10.
Question mark ID is equal to 10. Now, path variable is used to get values from URL path like user/10. Okay, so difference is in URL structure. And honestly, path variable is more restful for resource identification. Now, the next question is how do you handle null values safely in Java? So, null handling is very important because null pointer exception is very common in coding. So, first always check for null before accessing any object or use objects.requireNonNull.
Also, use You can use optional class to avoid direct null uses. And so, defensive coding is key in this case.
Now, moving to the next question, what is the purpose of the optional class?
So, optional is used to avoid null. It wraps a value which may or may not be present. Instead of returning null, you can return optional. Then, you can use methods like is present or or else. So, basically, it makes code more readable and safer. Now, coming to our next question, what is the difference between executor service and threads? Thread is a low level. You can create and manage manually. Executor service is on the higher level. It manages thread pool, so you can reuse threads, and it is good for the better performance. Also, it provides methods for task execution. So, always prefer executor service in real application. So, that was it from this interview. I hope these questions and answers will help you a lot. And if you like this video, make sure to subscribe to the channel and share it with your friends as well who are preparing for the interview. And don't Don't if you want to share your interview questions as well, uh you can fill out the form in the description. I will see you in the next video. Thank you so much.
Related Videos
Agentforce NOW AMA: Build with React and Salesforce Multi-Framework
SalesforceDevs
490 views•2026-05-28
How agent o11y differs from traditional o11y — Phil Hetzel, Braintrust
aiDotEngineer
450 views•2026-05-28
WEB TECHNOLOGIES UNIT-2 | Degree 4th sem BCOM Computers web technologies unit-2 full explanation💯✅
LearnwithSahera
1K views•2026-05-29
More tests are always better? How to use AI to identify tests that bring little value
Alliance4Qualification
335 views•2026-05-29
Search Algorithms Explained in 60 Seconds! 🤖💨
samarthtuliofficial
218 views•2026-06-01
People of Game of Thrones using JavaScript DOM
AltCampus
296 views•2026-05-30
Introduction to Problem Solving Part - 1 | Lecture 1 | Intermediate DSA
ascensionix
107 views•2026-05-29
🚀 BCS613C Compiler Design | Module 1 to 5 Schema Evaluation 🔥 | VTU 6th Sem 💯 #VTU #bcs613c #exam
Pranavaa-y4y
104 views•2026-06-02











