How to Manage Profiles in Spring Boot (with Docker)?
Spring Boot allows you to use profiles to separate configurations by environment, such as development (dev), staging (staging), and production (prod). This makes it easier to manage settings like database URLs, feature flags, and other environment-specific behaviors. In this post, you’ll learn how to: 📁 File Structure 🔧 Configuration Files 🔧 application.properties (common) 🔧 application-dev.properties…
Read More
How to use Domain Events in Spring?
In the world of Domain-Driven Design (DDD), Domain Events are a powerful way to notify different parts of a system that something meaningful has occurred within the core domain. Within the Spring ecosystem, event support is simple yet highly effective for decoupling components, improving cohesion, and enabling systems to evolve gracefully. In this post, you’ll…
Read More
How to create an interceptor in Quarkus?
When developing REST APIs, it’s common to want to intercept requests and responses to log information, validate data, or even apply business rules and security checks. In JAX-RS-based applications, like those using Quarkus, this is possible using request and response filters. In this post, we’ll explore how to implement a simple interceptor in Quarkus that…
Read More
Docker: Essential Commands Every Developer Should Know
Docker has revolutionized the way developers package, distribute, and run applications. With it, you can create portable and standardized environments with incredible ease. To make the most of this powerful tool, it’s essential to master some basic commands that are part of daily work with containers, images, and networks. In this post, we’ll explore the…
Read More
Timezones in Java: How to Schedule Classes Correctly Across Time Zones?
Imagine you’re developing a platform like Cambly, where students and teachers are spread across the globe. A student in Brazil wants to schedule a class at 10:00 AM local time with a teacher living in Australia. How can you ensure that both are connected at the right time, even though they’re in different time zones?…
Read More
How to avoid race condition in shared resources in Java?
Sharing resources between threads can be a challenging task, as it requires ensuring that operations are atomic. What is a resource? A resource can be variables, data structures, files, messages, etc. In Java, we have two important memory areas: the Stack and the Heap. Why use shared resources between threads? There are many reasons, but…
Read More
How to use Kafka with Quarkus?
Apache Kafka is one of the most popular solutions for large-scale distributed event streaming. Its ability to handle high volumes of messages makes it ideal for event-driven architectures. In this post, you’ll learn how to use Kafka with Quarkus, a modern framework for cloud-native Java applications. Best of all: Quarkus’ Kafka support also works with…
Read More
What are Checked vs Unchecked Exceptions in Java?
In Java, exceptions are part of the Throwable hierarchy and are used to signal abnormal situations during the execution of a program. Understanding how exceptions are structured helps in designing more robust and readable code. At the top of the hierarchy is the Throwable class, which has two direct subclasses: Checked Exceptions Checked exceptions are…
Read More
How to paginate using Spring Data JPA?
Spring Data JPA enables pagination through the JpaRepository interface, which extends PagingAndSortingRepository — an interface that provides pagination support. Let’s go over more details with a practical example. If you need to understand how Spring Data JPA works, there are more articles on the blog explaining that: Hands on You’ll need some of the following…
Read More
How to start Kafka using Docker?
It’s possible to use Kafka on various operating systems, but here we’ll use Docker on Ubuntu Linux. We need Docker Desktop installed in order to proceed. You can follow this tutorial to install it:👉 tutorial . Go to Docker Hub and in the search bar, look for “apache kafka”. This will allow us to download…
Read More