Author: Editorial Team
-
Custom banner in Spring Boot
1. Introduction Whenever Spring Boot application is started, a banner is printed. The banner looks like the following: This startup banner can be customized. We can use custom text as well as image. 2. How to customize banner in Spring Boot? There are two ways to change the banner: Adding banner.txt file in classpath. In…
-
Lazy Initialization in Spring Boot
1. Introduction In this tutorial, we’ll discuss lazy initialization in Spring Boot application. By default in Spring, beans are created at application startup. However, we can override this default behavior. There may be a requirement to not create a bean at application startup. The reason could be many. If the creation of bean is too…
-
Comparator in Java
Comparator interface provides a way to control the sort order on some collection of objects. Comparator like Comparable interface imposes a total ordering on some collection of objects. Comparator can be used to control the order of certain data structures like sorted sets. Comparator can be used to provide an ordering for collections of objects…
-
Comparable in Java
1. Introduction Comparable interface is provided in java.lang package. This interface is a part of Java Collections Framework. This interface imposes total ordering on the objects of the class which implements this interface. This ordering is referred to as the natural ordering. The Comparable interface provides a method compareTo which is referred as its natural…
-
hashCode method in Java
1. Introduction In this tutorial, we’ll discuss what is hash code in Java and the hashCode() method provided in Object class. Hash code is one of the most important concepts of Java and used extensively in data structure implementations like HashMap. Whenever you want to override the custom behavior of few data structures provided by…
-
Thread interruption in Java
1. Introduction A Java program with more than one thread finishes only when all non-daemon threads have finished execution or one of the threads call System.exit() method. Sometimes, you may need to terminate a thread when you want to cancel the task that the thread is doing. When there is such requirement, we can interrupt…
-
Generations and generational garbage collection in Java
1. Introduction In this tutorial, we’ll discuss how garbage collector works. We’ll also discuss generations and generational garbage collection process. An object is considered to be eligible to be collected by garbage collector when it can no longer be reached from any reference of any live object in the running program. The memory of any…
-
Selecting a garbage collector for application in Java
Introduction In this tutorial, we’ll discuss why there could be need to define the garbage collector for your application. What are the factors which help in decision making for selecting the garbage collector. Java can be run on different types of machines and devices. Java HotSpot VM provides multiple garbage collectors to meet different requirements.…
-
Maximum pause-time and throughput garbage collection in Java
1. Introduction In this tutorial, we’ll discuss two important terms in relation to garbage collection in Java – pause time and throughput. Understanding of these two terms is very important as understanding of these two terms helps in adjusting various parameters related to garbage collection for application performance. 2. Pause time in garbage collection During…
-
Garbage collection in Java and types of garbage collectors
1. Introduction If you have used C programming language then you must be aware that it is the responsibility of the programmer to release the used memory at the end of the program. This memory management is very important as a system has limited memory and if not properly managed could lead to memory related…
