Configuring the PasswordEncoder method

First, we'll declare an instance of PasswordEncoder as a normal Spring bean, as follows:

    //src/main/java/com/packtpub/springsecurity/configuration/SecurityConfig.java

@Bean
public ShaPasswordEncoder passwordEncoder(){
return new ShaPasswordEncoder(256);
}

You'll notice that we're using the SHA-256 PasswordEncoder implementation. This is an efficient one-way encryption algorithm, commonly used for password storage.