Java

Spring Boot + PostgreSQL – Integration Testing with Testcontainers

Integration testing is critical for ensuring that your application interacts correctly with external systems. In this project, we demonstrate how to perform integration testing in a Spring Boot application using PostgreSQL as the database and Testcontainers to run a real PostgreSQL instance during tests. This approach helps create a production-like, isolated, and repeatable testing environment. […]

Spring Boot + PostgreSQL – Integration Testing with Testcontainers Read More »

GraphQL + Spring Boot example

GraphQL is a query language for APIs that was developed by Facebook in 2012 and open-sourced in 2015. It provides a powerful, flexible alternative to REST by allowing clients to request exactly the data they need in a single request, thereby reducing over-fetching and under-fetching issues. While GraphQL offers great advantages such as efficient data

GraphQL + Spring Boot example Read More »

How RabbitMQ Works: Standard Message Flow and Routing Types

In this article, we explore how RabbitMQ, the popular message broker, works to facilitate communication between different components of a system. We will break down the standard message flow in RabbitMQ and explain the different types of routing available, providing a clear understanding of how messages are published, routed, and consumed. Standard RabbitMQ Message Flow

How RabbitMQ Works: Standard Message Flow and Routing Types Read More »

Spring Boot + DataMongoTest + Testcontainers: Testing MongoDB Repositories with a MongoDB Container

Introduction The @DataMongoTest annotation in Spring Boot is designed for isolated testing of MongoDB repositories. By default, it configures an embedded MongoDB (Flapdoodle) for testing. However, in real-world scenarios, we might need to test against a real MongoDB instance without installing it locally. This is where Testcontainers comes in. What is Testcontainers? Testcontainers is a

Spring Boot + DataMongoTest + Testcontainers: Testing MongoDB Repositories with a MongoDB Container Read More »

Spring Boot + DataMongoTest: Testing MongoDB Repositories with Embedded MongoDB (Flapdoodle)

Introduction The @DataMongoTest annotation in Spring Boot is designed for isolated testing of MongoDB repositories. It automatically configures an embedded MongoDB instance using Flapdoodle, which eliminates the need for a real database. By default, @DataMongoTest: Automatically configures an in-memory MongoDB instance (Flapdoodle). Loads only MongoDB-related components (documents, repositories, etc.). Rolls back changes after each test,

Spring Boot + DataMongoTest: Testing MongoDB Repositories with Embedded MongoDB (Flapdoodle) Read More »

Spring Boot + DataMongoTest: Testing MongoDB Repositories with a Real Database

Introduction The @DataMongoTest annotation in Spring Boot is specifically designed for isolated testing of MongoDB repositories. It loads only MongoDB-related components, ensuring fast and efficient tests. By default, @DataMongoTest: Automatically configures an embedded MongoDB instance (Flapdoodle). Rolls back changes after each test, keeping the database clean. Excludes unnecessary beans (@Service, @Controller), making tests lightweight. However,

Spring Boot + DataMongoTest: Testing MongoDB Repositories with a Real Database Read More »

Spring Boot + DataJpaTest: Testing JPA Repositories with H2 Database

Introduction The @DataJpaTest annotation in Spring Boot is specifically designed for isolated testing of JPA repositories. Instead of bootstrapping the entire Spring Boot application, it loads only JPA-related components such as: ✅ @Entity classes✅ Spring Data JPA repositories✅ Database configuration What Happens When Using @DataJpaTest? By default, @DataJpaTest: Automatically configures an in-memory database (H2, HSQLDB,

Spring Boot + DataJpaTest: Testing JPA Repositories with H2 Database Read More »