In this post under Spring Core, I will explain with example the purpose of “@Bean” and “@Configuration” annotation. Earlier before the introduction of annotations in Spring project, we used to define beans in xml file. For example if we had a classes as shown below package package1; public class Bean1 { @Override public String toString()…… Continue reading Spring @Bean and @Configuration Simple Example
Month: July 2023
Changing display name when printing string format of an object
In this post under Lombok, I will show with example, the purpose of “name” attribute in “ToString.Include” annotation. Whenever we use “ToString” annotation on a class, it generates the string format of an object where field name (also can be called as display name) are equal to object property name. So for example if below…… Continue reading Changing display name when printing string format of an object
Configuring the order of filters
In previous post under JAX-RS Client, I showed with example how to register filters for a particular client. The filters are executed in the order they are registered. We can change the order of execution by giving a priority to each filter. Filters with lower priority will be executed first. To demo this, we will…… Continue reading Configuring the order of filters
AssertInstanceOf Example
In this post under JUnit 5, I will show with example, the purpose and how to use “assertInstanceOf” method. The assertInstanceOf method from JUnit 5 can be used to verify whether an object is actually an instance of the specified class or not. If an object is actually an instance of passed in Class, then…… Continue reading AssertInstanceOf Example
Communication between host and Container
In this post under TestContainer, I will show with example how to make the host communicate with the docker container. Below is the complete code for your reference. Main Class 1 package package3; 2 3 import org.testcontainers.containers.GenericContainer; 4 import org.testcontainers.utility.DockerImageName; 5 6 public class Example3 { 7 public static void main(String[] args) { 8 DockerImageName…… Continue reading Communication between host and Container