Skip to content

Lazy Validator resolution in MethodValidationPostProcessor #28990

Closed
@jhoeller

Description

@jhoeller

In the course of our implicit JDK proxy registration attempts in #28980, we got reminded that MethodValidationPostProcessor was used with lazy Validator initialization in Spring Boot: https://github.com/spring-projects/spring-boot/blob/main/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/validation/ValidationAutoConfiguration.java#L72

Due to the lack of lazy initialization support in MethodValidationPostProcessor itself, Boot had to resort to @Lazy with creates a lazy resolution proxy for the Validator interface at dependency injection time. With explicit lazy resolution support through configuring an ObjectProvider<Validator> on MethodValidationPostProcessor, this should not be necessary and therefore not require a proxy hint anymore.

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions