Duplicate
Details
Assignee
UnassignedUnassignedReporter
Anatoliy BalakirevAnatoliy BalakirevBug Testcase Reminder (view)
Bug reports should generally be accompanied by a test case!
Bug Testcase Reminder (edit)
Bug reports should generally be accompanied by a test case!
Participants
Anatoliy BalakirevGuillaume SmetMarko BekhtaComponents
Affects versions
Priority
Major
Details
Details
Assignee
Unassigned
UnassignedReporter
Anatoliy Balakirev
Anatoliy BalakirevBug Testcase Reminder (view)
Bug reports should generally be accompanied by a test case!
Bug Testcase Reminder (edit)
Bug reports should generally be accompanied by a test case!
Participants
Anatoliy Balakirev
Guillaume Smet
Marko Bekhta
Components
Affects versions
Priority
Created January 10, 2023 at 2:29 PM
Updated January 11, 2023 at 8:27 PM
Resolved January 11, 2023 at 8:29 AM
We have a PUT REST endpoint, which accepts an autogenerated object, which is in fact a list of objects. We send a request there, which contains around 23k of elements. Elements in that list have a couple of concrete implementations, each has a couple of required fields and a list with a couple more elements of the same type. When hibernate validator is enabled on that endpoint - it takes somewhere between 30 and 50 seconds to validate everything. When I replace that validation with manually written methods - it takes around 0.5 seconds to validate the same. The sample project to reproduce this is here:
If you are on Linux, just run the following command in the root of the project (make sure your JAVA_HOME points to Java 17):
Or this on Windows:
And you’ll see these logs:
Which are basically about running three tests:
endpoint_with_explicit_validation
- validation is done with manually written methodendpoint_with_validation
- validation is done using Hibernate Validatorendpoint_without_validation
- no validation at allIf you want to see what exactly is being validated - uncomment this line:
I’m using the latest Spring Boot version (3.0.1), Java 17.0.5 (Amazon Corretto) and Maven 3.8.6
P.S. I’m not sure if this should be a Bug or rather an Improvement, so left the default one there.