-
-
Notifications
You must be signed in to change notification settings - Fork 69
config: migrate hibernate validator from v7 to v8 #2316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
jo-elimu
merged 2 commits into
main
from
2315-migrate-hibernate-validator-from-v7-to-v8
Jul 28, 2025
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Validate source-code compatibility with Hibernate Validator 8
Upgrading to
org.hibernate.validator:hibernate-validator:8.0.0.Final(and validation-api 3.0.2) is generally straightforward when already on the Jakarta namespace, but HV 8 drops support for any residualjavax.validation.*imports and requires at least Java 11.Check that:
jakarta.validation.*.🏁 Script executed:
Length of output: 286
🏁 Script executed:
Length of output: 271
Ensure Jakarta EL implementation is declared for Hibernate Validator 8
I verified the following after upgrading to
hibernate-validator:8.0.0.Finalandvalidation-api:3.0.2:javax.validation.*imports in your codebase.ConstraintValidatorimplementations (so pruning of internal SPI won’t affect you).However, I did not detect any Jakarta EL implementation on the classpath. Hibernate Validator 8 no longer shades its own EL, so you must explicitly add one.
Please update your
pom.xmlto include a Jakarta EL provider, for example:🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@coderabbitai What is this dependency needed for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jo-elimu Jakarta EL (Expression Language) is needed for constraint violation message interpolation in Hibernate Validator.
Here's why it's essential:
What Jakarta EL does in validation:
${validatedValue},${min},${max}, etc."Value '${validatedValue}' must be between {min} and {max}"Example usage:
Why it's now separate in HV 8:
Without Jakarta EL, you'll get runtime errors when Hibernate Validator tries to interpolate constraint violation messages, especially those with dynamic expressions.
🧠 Learnings used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@coderabbitai Will constraint violation annotations still work, even if we don't add the Jakarta EL (Expression Language) dependency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jo-elimu Yes, basic constraint validation will still work without Jakarta EL, but you'll encounter limitations with message interpolation.
What will work:
@NotNull,@Size,@Email, etc. will still validate correctlyConstraintViolationobjects createdWhat will break:
${validatedValue},{min},{max}expressionsjavax.el.ELExceptionor similar when violations occur with dynamic messagesExample behavior:
Recommendation:
Since you're likely using some form of message interpolation in your validation annotations, I'd strongly recommend adding the Jakarta EL dependency to avoid potential runtime issues. It's a small addition that ensures full compatibility with Hibernate Validator 8.
Want me to check your codebase for any validation messages that might be affected?
🧠 Learnings used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@coderabbitai Yes, please check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Length of output: 1089
🏁 Script executed:
Length of output: 3024
🏁 Script executed:
Length of output: 2764
@jo-elimu Based on my comprehensive analysis of your codebase, you can safely proceed with the Hibernate Validator 8 upgrade without adding the Jakarta EL dependency for now.
Key findings:
✅ Your validation usage is very simple:
@NotNull{min},{max}, or${validatedValue}✅ No EL-dependent features detected:
What this means:
Your application uses default validation messages provided by Hibernate Validator. Since you're not using any custom message interpolation, the absence of Jakarta EL shouldn't cause immediate issues.
Recommendation:
If you encounter any validation-related errors after deployment, then add the Jakarta EL dependency:
Your current validation setup should work fine with Hibernate Validator 8! 🎉
🧠 Learnings used