Skip to content

JSR validator bean missing if a custom Spring Validator bean is present #8976

Closed
@oyvindhorneland

Description

@oyvindhorneland

This problem occurred after upgrade from Spring Boot 1.5.2 to 1.5.3.

I have some custom Spring validator beans for Spring Data REST while also relying on standard JSR validator in other parts of the application.

After upgrading from Spring Boot 1.5.2 to 1.5.3 there is no longer a JSR validator bean present.

Error:

Bean method 'defaultValidator' in 'DefaultValidatorConfiguration' not loaded because @ConditionalOnMissingBean (types: javax.validation.Validator,org.springframework.validation.Validator; SearchStrategy: all) found beans 'beforeSaveUserValidator', 'beforeCreateGroupValidator', 'beforeCreateUserValidator'

Debug auto configuration:

DefaultValidatorConfiguration#defaultValidator:
      Did not match:
         - @ConditionalOnMissingBean (types: javax.validation.Validator,org.springframework.validation.Validator; SearchStrategy: all) found beans 'beforeSaveUserValidator', 'beforeCreateGroupValidator', 'beforeCreateUserValidator' (OnBeanCondition)

c9561f0 changed this behaviour since it does not provide a validator if a Spring validator is present.

Not sure if this is should be considered a bug and I can easily work around this problem and provide this bean myself, but perhaps Spring Boot could create a JSR validator if not present?

Metadata

Metadata

Assignees

Labels

type: regressionA regression from a previous release

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions