Rich API documentation is a vital element of any successful project, especially if it has to be integrated by third parties. Unfortunately, Spring Boot does not have an out-of-the-box solution for Swagger documentation. So we must use a third-party library (Springdoc-openapi) for that purpose. In this article, we cover how to add Spring Boot Swagger […]
Category: Kotlin
A category for Kotlin related articles.
Like any other external dependency, we can write integration tests using Testcontainers for a Spring Boot application. However, unfortunately, Testcontainers does not have any library for Redis, and using Kotlin makes it even trickier. In this article, we explore how to write Spring Boot Redis integration test with Testcontainers in Kotlin. Introduction There are two […]
Error handling in Spring Boot is simple, easy, and efficient. Yet it can be daunting sometimes as different types of validation exceptions and annotations are supported by the Spring framework. In this tutorial, we go over how to handle MethodArgumentNotValidException in Spring Boot. Additionally, we discuss a similar exception known as ConstraintViolationException and highlight the […]
Kotlin supports different scope functions for many purposes. Some have overlapping functionalities such as let, also, and so on. In this article, we discuss the differences between let, also, run, with, and apply functions in Kotlin. Introduction Kotlin is one of the most beloved JVM languages. It is less verbose compared to Java. Additionally, unlike […]
In many cases, we need to connect to multiple datasources from the same service due to business requirements. In this article, we discuss how to configure Spring Boot to connect to multiple datasources. Additionally, we address configuring the datasources to create tables if they don’t exist. An imaginary example Let’s assume that we have a […]
Spring Boot officially supports Kotlin. It works perfectly for almost everything except Spring Data JPA. To be realistic, that is not even a Spring issue. It’s mainly related to how Hibernate entities work. Since Spring Data JPA uses Hibernate by default under the hood, the issue became a Spring problem. In this tutorial, we explain […]