How to Enable Spring Data MongoDB Auto Index Creation

Overview If you have tried setting auto-index-creation in spring data mongodb without success, like this: Then this post will show you how to work around this. Let’s get started. Enable auto index creation in MongoDB First, let’s consider this document Here, I defined an unique index for my document named rate_limit_config_service_name but when the application … Read more

6 Ways To Directly Initialize a HashMap in Java

Java provides several ways to initialize a HashMap directly, making your code more concise and readable. In this blog post, we’ll explore different methods to create and populate a HashMap in one go using Java. 1. Using Map.of() (Java 9+) For small, immutable maps, you can use the Map.of() method: This method is convenient but … Read more