HaveIBeenPwnedRule setAllowExposed method example

In previous post under Passay, I showed with example how to use “HaveIBeenPwnedRule” rule. In this post, I will explain with example the purpose of “setAllowExposed” method of “HaveIBeenPwnedRule” rule class. Just for recap, there is a website “haveibeenpwned.com” that contains a list of real world passwords that were previously used and exposed as part…… Continue reading HaveIBeenPwnedRule setAllowExposed method example

Autowiring interface with multiple implementation

Autowiring interface with multiple implementation In this post, I will explain with example how to inject a bean whose type is an interface (Java Interface or Abstract class) and it has multiple classes that implements it. In the previous post, I showed how Spring Framework inject a bean whose type is an interface and has…… Continue reading Autowiring interface with multiple implementation

Autowiring interface with single implementation

In all my previous posts under Spring Core, I showed how to inject a bean belonging to a particular class. But in reality, to maintain a loose coupling we program to an interface and not to a class. (Interface doesn’t represent Java Interface. Here Interface is generic term that represents either Java Interfaceor Java Abstract…… Continue reading Autowiring interface with single implementation

Autowiring By Name (@Qualifier annotation)

In this post under Spring Core, I will explain with example how to autowire beans based on names instead of bean type. Till now in all our previous posts, beans to be injected were figured out by the class type. Sometimes there exist a situation where when Spring framework tries autowire a bean of a…… Continue reading Autowiring By Name (@Qualifier annotation)

Spring @Primary annotation

In this post under Spring Core, I will explain with example the purpose of “@Primary” annotation. When doing autowiring by type, there may be scenarios where two bean definitions can be considered for injection. For example if we have below DAO class package package26; public class Dao { private String daoName; public Dao(String daoName) {…… Continue reading Spring @Primary annotation

InitialDirContext lookup method

In this post under Java LDAP, I will show how to lookup for an entry in LDAP directory tree using ldap distinguished name. Below is the complete main class for your reference Main class 1 package package2; 2 3 import java.util.Hashtable; 4 5 import javax.naming.Context; 6 import javax.naming.NamingException; 7 import javax.naming.directory.DirContext; 8 import javax.naming.directory.InitialDirContext; 9…… Continue reading InitialDirContext lookup method

Connecting to LDAP server

In this post under Java LDAP, I will explain how to connect to LDAP server with an example. Below is the complete code Main Code 1 import java.util.Hashtable; 2 3 import javax.naming.Context; 4 import javax.naming.NamingException; 5 import javax.naming.directory.DirContext; 6 import javax.naming.directory.InitialDirContext; 7 8 public class LDAPDemo1 { 9 public static void main(String[] args) { 10…… Continue reading Connecting to LDAP server