Skip to main content

Posts

Spring & Hibernate Interview Questions: What Really Happens Under the Hood?

  Spring & Hibernate Interview Questions: What Really Happens Under the Hood? After my previous blog on Java & Spring internals , one thing became pretty clear: Knowing the annotation is easy. Explaining what happens because of that annotation is where the real interview begins. You can write: @Transactional But do you know how Spring actually starts the transaction? You can add a Spring Boot dependency. But do you know why Spring suddenly creates a bunch of beans? You can modify a JPA entity without explicitly calling save() . But do you know why Hibernate still sends an UPDATE query? And here's the one I really like: Two users try to buy the last item in stock at exactly the same time. What happens? These are the kinds of questions that move an interview from "Do you know Spring?" to "Do you actually understand Spring?" So, let's go under the hood again. 🔹 Spring & Spring Boot 1. @Bean vs @Component — What's Actually Different? At firs...
Recent posts

Java & Spring Interview Questions: What Really Happens Under the Hood

  Java & Spring Interview Questions: What Really Happens Under the Hood There is a phase in every developer's career where you can use something without actually understanding what is happening underneath. You know how to use ConcurrentHashMap . You know what @Transactional does. You know that Spring injects dependencies. You know @SpringBootApplication starts your application. And then the interviewer asks: "Okay, but what actually happens internally?" Suddenly, knowing the syntax isn't enough. That is exactly what this blog is about. I'm going to break down some of the Java and Spring concepts that are frequently asked in interviews, but more importantly, I'll try to understand why they work the way they do . Let's start with one of my favourites. 1. ConcurrentHashMap in Java 8: What Actually Happens? Let's first establish the problem. A normal HashMap is not thread-safe. Imagine two threads doing this at the same time: map.put("A",...

Think You Know Java? These 5 Questions Say Otherwise

  Hello everyone! Hope you’re sipping your coffee just right—because I’ve brewed something equally strong for your brain. Welcome to a blog that dives into 5 deceptively tricky Java interview questions —the kind that test not just what you know, but how well you understand Java under the hood. If you, like me, share a love-hate relationship with this language, this blog might just hit home. So, let's get started... Question 1: What will be the output of the following code? Why? class Parent { static void staticMethod() { System.out.println("Static method in Parent"); } private void privateMethod() { System.out.println("Private method in Parent"); } void show() { staticMethod(); privateMethod(); } } class Child extends Parent { static void staticMethod() { System.out.println("Static method in Child"); } private void privateMethod() { System.out.println("Pr...

Some Useful and Simple Cmd commands everybody must know

  What gives you a feeling of power? -- Using your computer through a command shell! Throughout my journey as a Tech-Enthusiast, it has been a thing to know and work on the cmd shell on my windows device. Here I'm going to share some crazy, simple, and useful commands which you must know as a Techie and here we go... Know your saved Wi-Fi password using Netsh   If you have ever found stuck in a situation where you are unable to extract a password already saved on your device? Well here is your savior the netsh command, here is how can you use it: Start your command prompt by typing cmd in the search. Type "netsh wlan show profile" (This command will give you the list of all the profiles associated). Now you need to type "netsh wlan show profile "profile_name" key =clear ". And now the key content displays the password of your selected wlan profile. Run this command on your friends' devices and let them look at you with that awestruck gaze!   Change...

"Aggregation of Marginal Gains" strategy that blew my mind

 Did you miss me? Wait; you don't even know me? Craaapp! Hello Dotson this is me Saurabh Aggarwal and I'm back here (once again) to have a little chitchat with you and share something valuable to add to your life. Before you start judging me that yeh kya naya batayega  let me tell you that the idea I'm sharing with you, is not new and you might already know  about it but here's my perspective to add which is quite novel (quite..) So the thing is I was currently reading a book (ofcourse not my syllabus book) and this book  stated a "magical strategy" which could help anyone become the best version of oneself. To be honest i have heard a lot about the thing like becoming the best version of oneself and blah blah. So, at first  neurons of my brain decided not to pay much attention to this specific section  but what suddenly caught my eyes were the stats of the Olympics that a team of British cyclists which could only grab a single gold medal b...

Why is it important to have "WHY"?

Hey Mitra, did you smile today? If not then, let me give you a reason to: You are the chosen one to live this beautiful life, once and for all! Ahh, hope that worked, Let's start our talk. Why?  An illustration  If I go on telling you that "Why" is such a magnificent word which can turn the "impossible" into "I'm possible". Would you believe me? Maybe not, so let me illustrate to you a scenario to keep my point in a  clear manner.  Imagine yourself sitting on your couch, watching Taarak Mehta Ka Ooltah Chashmah and you suddenly start to crave for your favourite samosa as the Zomato ad pops us in the break. You just think of going to  Ratan's Samosa Shop which is just 100m away from your home.  But it's raining heavily outside. Would you step outside and get some samosas or continue watching TV (cursing Zomato )? When asked to a group of students, 97% of them agreed to stay at home while the remaining were hardcore samosa lovers. Now imagine...