Importing multiple @Configuration classes into one master @Configuration class

In this post under Spring Core, I will explain with example how to import multiple “@Configuration” classes into one master “@Configuration” class. In my previous posts, I have created “@Configuration” annotated classes and defined one or two beans in them for my example. Whereas in production code, there will be many bean definitions more than…… Continue reading Importing multiple @Configuration classes into one master @Configuration class

Using @EqualsAndHashCode annotation

In this post under Lombok, I will explain with example the purpose and how to use “EqualsAndHashCode” annotation. This annotation is applied at the class level only. This annotation instructs Lombok to automatically generate “equals” and “hashCode” method. When generating “equals” and “hashCode” method it considers all non-static and non-transient fields. For our example we…… Continue reading Using @EqualsAndHashCode annotation

Setting Environment Variable

In this post under TestContainer, I will explain with example how to set environment variable before starting a container. For our example, we will use the latest “postgres” image from Docker Hub. According to “postgres” help page on Docker Hub we only need to set the environment variable “POSTGRES_PASSWORD” to start the postgres container and…… Continue reading Setting Environment Variable

Registering multiple @Configuration annotated Classes

In the previous post under Spring Core, I explained with example the purpose of “@Configuration” annotation. Just for recap, classes marked with “@Configuration” annotation are informing the Spring framework that it contains bean definitions. Let’s call class marked with “@Configuration” as “Configuration Class”. It will help you in understanding this post. Spring then uses “AnnotationConfigApplicationContext”…… Continue reading Registering multiple @Configuration annotated Classes