Skip to content

Improve performance of validation groups determination #36274

@rstoyanchev

Description

@rstoyanchev

We inspect controller methods for method validation once on startup, and it results in the shouldValidate~ flags that protect method validation at runtime.

Validation groups however are determined by delegating to MethodValidationAdapter, which is only available in RequestMappingHandlerAdapter, so it only becomes available to each HandlerMethod at runtime, and as a consequence, it's invoked per request.

We should be able to optimize this determination to be made once on startup. In the very least, the shouldValidate~ flags should be used to avoid the determination of validation groups if validation is not even needed in the first place.

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)status: backportedAn issue that has been backported to maintenance branchestype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions