Lab: Major Release Considerations ‐ 5: Update Password Encoders - shinyay/spring-boot-2-7-to-3-1-upgrade GitHub Wiki

5: Update Password Encoders The PasswordEncoder implementations have been moved to static factories going forward.

One caveat here, is that you'll need to scope these to the major/minor version of Spring Security.

Update the usage of Pbkdf2PasswordEncoder.

Replace the return statement with the static factory method for Spring Security 5.8

return new Pbkdf2PasswordEncoder return Pbkdf2PasswordEncoder.defaultsForSpringSecurity_v5_8(); NOTE: This factory method has the Spring Security major/minor version in the method signature.

Compile the code.

Now is a good time to Compile the code again.

[~/exercises] $ ./mvnw clean compile Success! You've been able to deal with all the Spring Security deprecations... Nice!

[INFO] Compiling 5 source files to /course-spring-boot-2-7-to-3-1-upgrade-code/target/classes [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ Update our notes.

Before we move on, let's note the change again in the upgrade-notes.md file.

  • Replaced new Pbkdf2PasswordEncoder with static factory method for Spring Security 5.8 No more deprecations! Are we done? Let's find out.