The Journey of John: Exploring Java, Spring, Hibernate, and Microservices

Kacper Bąk
2 min readJun 5, 2023

Once upon a time, in the vast landscape of Java development, lived a monolithic application called “John’s App”. John’s App was a powerful, all-inclusive software system designed with diligence and keen attention to detail. Over time, however, as the application grew, its maintenance became a daunting task. It was a colossal entity that demanded extensive resources, making updates or enhancements a tedious affair.

The first hurdle in John’s App was managing its data. The application contained multiple objects, each characterized by certain attributes. In an attempt to optimize, developers decided to leverage Java HashSet to store unique objects. But soon, they faced a predicament - when two objects shared identical attributes, they appeared as duplicates. This led them to reimagine object equality, employing hashCode() and equals() methods to uniquely identify similar objects.

Next, they ventured into the realms of functional interfaces, exploring how one interface could be replaced with another. They discovered that interfaces with identical single abstract methods (SAM) could be swapped seamlessly, courtesy of Java’s functional interface and lambda expressions.

However, data that persisted in memory was not sufficient. This led them to the doors of persistence libraries, such as Hibernate and Spring Data JPA. Hibernate’s “session” offered a first-level cache out of the box, storing data as long as the session was alive. They also…

--

--