Fixes at the end

Here are the fixes in this chapter:

  • Fixadding/registering to request mapping: If you run the mvn spring-boot:run command after a clean install and then open the page at https://localhost:8080/register, you will see a 404 error page. This is because we haven't added /register to @GetMapping inside MainController. Let's fix it now. Once it is fixed, try to perform a registration from the register page. After registration, you should see the debug information that UserRegisteredEventHandler created.

Not adding /register to the mapping reveals a defect in our end-to-end testing. The end-to-end test is supposed to capture this kind of issue during building. Unfortunately, it didn't. We will improve our end-to-end testing in the next chapter. The following is the commit record:

Figure 9.14: Fix—add/register to request mapping commit
  • Fixinvalid return value of encrypt() method: In our implementation of PasswordEncryptor, PasswordEncryptorDelegator, the encrypt() method returns a null value, which causes the registration failure. Let's change it to return the raw password for now, so that we can have successful registration. We will use Spring Security's PasswordEncoder in the next chapter to encrypt the password.

   The following is the commit record:

Figure 9.15: Fix—the invalid return value of encrypt method commit
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.205.235