In previous post under Passay, I showed with example the purpose of “IllegalSequenceRule”. For recap, this rule makes sure that the password doesn’t contain the given character sequence, for example “qwerty” character sequence. So if the password is “qwerty” or “sam_qwerty_@”, the validation will fail but if the password is “aabb”, the validation passes. When…… Continue reading IllegalSequenceRule with custom character sequences example 1
Author: sumanthprabhakar
CollectionUtils selectRejected method
In this post under Apache Collections, I will show with example the use of “selectRejected” method. “selectRejected” is a static method available under “CollectionUtils” class. It takes two arguments1) input collection2) predicate In this method, the predicate is evaluated on each item of the collection and a new collection is returned which contains items from…… Continue reading CollectionUtils selectRejected method
Using @Lookup on method with its local and instance arguments
In my previous post under Spring Core, I have explained the use of “@Lookup” annotation and how to use it with or without its arguments. In this post, I will show with example, how we can use “@Lookup” (with or without its argument) with a method that takes a local variable and instance variable as…… Continue reading Using @Lookup on method with its local and instance arguments
Calling mapper interface method from another mapper interface code
In this post under MapStruct, I will show with example how to call one mapper interface method from another mapper interface code. For our example I will create “Address” pojo class that will be shared by “Student” and “Person” pojo class as shown below. Address package package31; public class Address { private String addressLine1; private…… Continue reading Calling mapper interface method from another mapper interface code
BeanPostProcessor example
In this post under Spring Core, I will explain with example the purpose and how to use “BeanPostProcessor” interface. In Spring framework when a bean is created, It is first constructed by calling its constructor, then dependencies are injected and initialization logic if any is executed. It is during this initialization phase that we can…… Continue reading BeanPostProcessor example
Using @Lazy annotation with @Autowired annotation example
In this post under Spring Core, I will show with example how to use “@Lazy” annotation with “@Autowired” annotation and how it change the behavior of Spring framework. In previous post, I showed with example how to use “@Lazy” annotation with “@Component” and “@Bean” annotation and how they change the behavior of Spring framework. Just…… Continue reading Using @Lazy annotation with @Autowired annotation example
Using @Lazy annotation with @Bean and @Component example
In this post under Spring Core, I will explain with example the purpose of “@Lazy” annotation and how it reacts when used with “@Bean” and “@Component” annotation. In Spring, we can use “@Lazy” annotation for two purposes1) to instruct Spring framework to lazily create a singleton bean2) to instruct Spring framework to lazily inject a…… Continue reading Using @Lazy annotation with @Bean and @Component example
CollectionUtils select method
In this post under Apache Commons Collections, I will explain with example the purpose of “select” static method in “CollectionUtils” class. This method is basically used to filter the collection based on defined predicate. Below is an example of its usage Main class package defaultPackage; import org.apache.commons.collections4.CollectionUtils; import java.util.ArrayList; import java.util.List; public class Example17 {…… Continue reading CollectionUtils select method
CharacterCharacteristicsRule example
In this post under Passay, I will explain with example, the purpose and how to use “CharacterCharacteristicsRule”. “CharacterCharacteristicsRule” acts as a container of other rules and we can configure it to say that out of n rules, make sure atleast first m rules are satisfied, where m < n. Below is the complete main class…… Continue reading CharacterCharacteristicsRule example
Using @ObjectFactory annotation to create target objects
In this post under MapStruct, I will explain with example the purpose of “@ObjectFactory” annotation. Till now in all my previous post, I have shown you that MapStruct uses constructor and builder method to create target objects. We can also create an object using factory methods. To instruct MapStruct to stop using constructor, buider method…… Continue reading Using @ObjectFactory annotation to create target objects