Skip to content

Phase 3b: Registration controller migration (Spring Boot)#12

Merged
cogjack merged 1 commit intodevin/1771291744-spring-boot-migration-phase1-2from
devin/1771292362-registration-controller
Feb 17, 2026
Merged

Phase 3b: Registration controller migration (Spring Boot)#12
cogjack merged 1 commit intodevin/1771291744-spring-boot-migration-phase1-2from
devin/1771292362-registration-controller

Conversation

@devin-ai-integration
Copy link
Copy Markdown

Phase 3b: Registration Controller Migration

Summary

Migrates EditRegistrationAction and SaveRegistrationAction from Struts 1.x to a Spring MVC RegistrationController, as part of the struts-faces-example2 Spring Boot migration. Converts RegistrationForm from a ValidatorForm subclass to a plain POJO with JSR-380 Bean Validation, and introduces a custom @PasswordMatch cross-field constraint.

New files:

  • form/RegistrationForm.java — POJO with @NotBlank, @Email, @PasswordMatch
  • validation/PasswordMatch.java + PasswordMatchValidator.java — custom class-level constraint for password confirmation
  • controller/RegistrationController.javaGET /editRegistration (form prep) + POST /saveRegistration (validate & persist)
  • templates/registration.html — minimal Thymeleaf template (unblocks controller tests; full UI is Phase 4)
  • RegistrationFormTest.java, PasswordMatchValidatorTest.java, RegistrationControllerTest.java

All 110 tests pass (13 form + 7 validator + 13 controller + existing 77).

Review & Testing Checklist for Human

  • Test isolation / shared mutable state: RegistrationControllerTest mutates the shared in-memory UserDatabase (e.g., createNewUserWithValidData creates "newuser", editExistingUserWithValidData changes the "user" object's fields). There is no @DirtiesContext or per-test reset, so test ordering could cause flaky failures. Verify this doesn't bite in CI or when new tests are added.
  • Dropped Struts token/cancel handling: The original SaveRegistrationAction had isTokenValid/resetToken/saveToken (CSRF-like) and isCancelled checks. These are absent from the new controller. Spring's built-in CSRF support may cover the token case, but confirm this is acceptable for the migration.
  • Password validation edge cases: In saveRegistration, password-required checks only run for action="Create". For action="Edit", the @PasswordMatch validator allows both-null or both-empty, and the controller preserves the old password if the new one is empty. Verify this matches the original Struts behavior and handles edge cases (e.g., one password field empty, the other not).
  • Duplicate username check timing: The controller checks for duplicate usernames after @Valid runs. If other fields have validation errors, the duplicate check still fires and adds another error. This is probably fine but differs slightly from Struts' ordering.

Notes

- RegistrationForm POJO with Bean Validation (@notblank, @Email)
- @PasswordMatch custom annotation and PasswordMatchValidator for cross-field password validation
- RegistrationController with GET /editRegistration and POST /saveRegistration
- Handles Create (new user) and Edit (existing user) actions
- Minimal registration.html Thymeleaf template
- Comprehensive tests: RegistrationFormTest, PasswordMatchValidatorTest, RegistrationControllerTest
- All 110 tests pass

Co-Authored-By: Jack  Meigel <jack.meigel@cognition.ai>
@devin-ai-integration
Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@cogjack cogjack merged commit 9b7a726 into devin/1771291744-spring-boot-migration-phase1-2 Feb 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant