Part 9 of 10 of Building Instagram's Authentication Backend . If you're just joining, the repo is here and you can catch the earlier parts on the YouTube playlist . Eight parts of code, zero runs By the end of part 8, every layer of this backend existed: DTOs, exceptions, entities, repositories, five services, a security filter chain and a controller. And I had never started the application. Not once. Everything so far was code I'd reasoned through and believed would work. This part is where that belief gets tested. We containerize the app, put Postgres, Redis and a fake mail server next to it, and bring all four up with one command. It did not work the first time, so this post is the real debugging session, with each bug, its symptom and its fix. If you're containerizing your own Spring Boot app, there's a good chance you'll hit at least one of these. In this post: A multi-stage Dockerfile for Spring Boot, line by line A docker-compose.yml ...
Java HashMap is one of the most frequently asked topics in Java interviews. Many developers use it daily, but very few understand how it actually works internally . In this article, we will explain: What HashMap is How HashMap stores data internally Role of hashCode() and equals() What collisions are and how they are handled Improvements made in newer Java versions Time complexity of all major operations How to reduce frequent collisions All explanations are in simple terms , with examples . 1. What Is a HashMap? A HashMap stores data in key–value pairs . Example: Map<String, Integer> map = new HashMap<>(); map.put("A", 10); map.put("B", 20); Key characteristics: Keys must be unique Values can be duplicated Order is not guaranteed One null key is allowed Multiple null values are allowed Why HashMap is popular: HashMap provides very fast access to data. 2. How HashMap Stores Data Interna...