Skip to content

Validator resolution can no longer be lazy #31137

Closed
@wilkinsona

Description

@wilkinsona

Affects: 6.1.0-SNAPSHOT

#28990 added support for configuring MethodValidationPostProcessor with a Supplier<Validator> that would then be used to resolve the Validator lazily. This laziness appears to have been lost as get() is called on the Supplier during afterPropertiesSet() processing. The problem becomes apparent when upgrading Spring Boot to 6.1.0-SNAPSHOT as methodValidationPostProcessorValidatorDependencyDoesNotTriggerEarlyInitialization in ValidationAutoConfigurationTests fails.

The regression can be worked around by reverting spring-projects/spring-boot@639f980 but it leaves setValidationProvider without a purpose. We'd also prefer not to have to use a lazy proxy in Boot.

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: regressionA bug that is also a regression

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions