Discover the Different Auto-Configuration Options in Spring Boot

The Spring Boot Auto-Configuration feature simplifies: automatic configuration of beans and components. When Spring Boot detects specific libraries or components in your project (like database dependencies or web modules), it automatically configures those components for you without needing explicit manual configuration.

Key Concepts:

  1. Auto-Configuration Conditions: Spring Boot applies auto-configuration on conditional and profile driven way to be classes available on the classpath or specific properties set in application.properties or application.yml.
  2. EnableAutoConfiguration: This annotation enables auto-configuration, it can be fine-tuned by excluding specific auto-configurations using exclude or excludeName attributes.
  3. @Conditional Annotations: Auto-configuration relies heavily on Spring’s @Conditional annotations, which control whether certain configurations should be applied based on the environment or classpath.
  4. Diagnostics: spring-boot-actuator provides insight into which configurations have been applied, helping with debugging and understanding the auto-configured components.

Documentation here.

Continue reading Discover the Different Auto-Configuration Options in Spring Boot

Mastering Lambda Expressions with Generic Types in Java

In Java, SAM (Single Abstract Method) interfaces are a key feature that enable the use of lambda expressions and functional programming concepts. A SAM is an interface that contains exactly one abstract method, common examples of SAM interfaces in Java include Runnable, Callable, and Comparator.
Any custom interface with a single abstract method can be treated as a functional interface, to be able to costumize code.

Continue reading Mastering Lambda Expressions with Generic Types in Java

Correlation Identifier: Ensuring Traceability in Distributed Systems

Correlation identifier of requests-responses is an essential feature of microservice platforms for monitoring, reporting, debugging and diagnostics.
Allows tracing a single request inside the application flow, when it can often be dealt with by multiple downstream services.

Problem statement

The most trending direction in software development is distributing processing and systems. In software architectual system designs there are multiple service layouts: single monolithic systems, SOA distribution, and nowadays microservice level grouping of services, applications.
In case of multiple services, we should consider, even multiple running entities from one specific service.

In case of looking into the logs, we could have a harder time to track down the chain of calls and locate the specific instances, which was hit by the request, through serving a user request.

Continue reading Correlation Identifier: Ensuring Traceability in Distributed Systems

Leveraging Server-Sent Events (SSE) with Spring WebFlux for Real-Time Data Streaming

Introduction

What options we have to gather long processing data from the backend to send out to the UI?
Usually the followings:

  • open frequent connections – polling
  • keep an open connection – websocket

Server Sent Events

With Server Sent Events you’re able to send continuous updates from the server.
Imagine as a client subscription to a server for a stream.
Sometimes we don’t need a full bi-directional protocol (sending data back from client side), just a non-blocking data flow with the ability to process data row by row, while still receiving from the connection.
These are updates, time splitted data chunks from the server side to provide a fluent UI experience.

Continue reading Leveraging Server-Sent Events (SSE) with Spring WebFlux for Real-Time Data Streaming

Multilevel-KeySearch – Solution for Complex Data Lookup Strategies

Why? What’s this all about?

This is a library to handle (store-search) multi level key attributes.
The implementation was driven by the need of

  • handle multiple level keys
  • flexible search
  • ranking/ordering

on the matches .

Lets consider data with multiple levels: category / subcategory / group / item levels for example.
If you want to find specific let’s say: subcategory, that’s an easy task. You can filter/map and you get it. But what if you have multiple attribute to match, multiple key lengths? How will you sort them? This task can be achieved, but requires more and more code and you lose fluency.

Continue reading Multilevel-KeySearch – Solution for Complex Data Lookup Strategies

Class-Method Caching: Boosting Performance in Java

When you have the need of caching that’s a quite common topic, you can find many out-of-the-box solutions.

But what if if you want to cache whole class, with all the methods, maybe across your whole application?
My solution based on a proxy class and this way applies cache on all method invocations. The cache configuration of course can be defined, but the basics can be seen in the example below:

Continue reading Class-Method Caching: Boosting Performance in Java