Spring Data JPA - JpaRepository methods deleteInBatch, getById, getOne are Deprecated

From recent version of Spring Data JPA JpaRepository methods like deleteInBatch(Iterable) , getById(ID) , and  getOne(ID)  are Deprecated. Instead use deleteAllInBatch(Iterable) and getReferenceById(ID) . The details are illustrated in below image: The following example creates a Spring Boot web application which uses getReferenceById(ID) and deleteAllInBatch(Iterable) methods. Project Directory pom.xml <? xml version ="1.0" encoding ="UTF-8" ?> < project xmlns ="" xmlns: xsi ="" xsi :schemaLocation ="" > < modelVersion >4.0.0</ modelVersion > < parent > < groupId >org.springframework.boot</ groupId > < artifactId >spring-boot-starter-parent</ artifactId > < version >3.0.1</ version >

Java - How to create an ArrayList from an Array?

In this section, we will write a Java program to create an ArrayList from an Array .  Following ways can be used for converting Array to  ArrayList : By using Arrays.asList() method By using Collections.addAll() method By adding each element of the Array to ArrayList explicitly Example 1: By using Arrays.asList() method  Using asList() method from an Arrays class will convert the given Array to an ArrayList . import java.util.ArrayList ; import java.util.Arrays ; public class Main { public static void main ( String []args) { String [] strArray = { "Java" , "Kotlin" , "C" , "Go" , "Python" }; ArrayList < String > list = new ArrayList< String >( Arrays . asList ( strArray )); System . out .println( list ); } } Console Output: [Java, Kotlin, C, Go, Python] Example 2: By using Collections.addAll() method Using addAll() method from the Collections class will

Spring Boot @ConditionalOnMissingClass Annotation Example

In this section we will learn about @ConditionalOnMissingClass  Annotation. The  @ConditionalOnMissingClass  can be used to register a bean only when the given class(es) cannot be found on the class-path.  For example, when providing library/framework classes to other developers, this annotation can be used to active certain beans only based on the absence of specific classes. The  @ConditionalOnMissingClass  annotation may be used on any class annotated with @Configuration ,  @Component ,  @Service  &  @Repository  or on methods annotated with  @Bean . 1. Using @ConditionalOnMissingClass on @Bean method To illustrate the use of  @ConditionalOnMissingClass , we will  create one simple service classe,  SMSNotificationService  class. public class SMSNotificationService { public SMSNotificationService() { System.out.println( "Inside SMSNotificationService Constructor" ); } public void sendSmsNotification() { System.out.println( "Sending S