JakTech Latest

0

Create a custom deserializer using Jackson Object Mapper

When working with complex Json data structures, it is easier to create a custom deserializer to map the json objects rather than having to create many separate models. The Json This Json is non...

0

What is the difference between SLF4J and LOG4J?

SLF4J and LOG4J are not comparable as they are two separate things. LOG4J is a logging framework, and SLF4J is a logging abstraction that uses logging frameworks like LOG4J under the hood. There are...

Featured Image Iterating Array 0

How to iterate over an array using Java Streams

Iterate over an array using Java Streams Printing elements in an array using Java Streams This stream using a lambda function in the forEach loop to print the element.

Mockito Cheat Sheet 0

Mockito Cheat Sheet

Difference between doThrow() and thenThrow() doThrow() is used for void return types: Mockito.doThrow(new NullPointerException(“Error adding user”)).when(userService).addUser(ArgumentMatchers.any()); thenThrow() is used for non void return types: Mockito.when(userService).addUser(ArgumentMatchers.any()).thenThrow(new NullPointerException(“Error adding user”));

Spring Boot CORS Cross Origin with Integration Test 0

Spring Boot CORS Cross Origin with Integration Test

Add CORS to a request mapping Add CORS to a request mapping using application properties value Change @CrossOrigin to reference the value from the application properties. Let’s assume the CORS header domain is stored...