Skip to content

Bean validation not picking error translations anymore #18672

Closed
@wiecia

Description

@wiecia

I have a spring boot application with default bean validation through hibernate validator.
I'm using custom messageSource - which in fact just picks up translations from diferrent places.
On my model classes I'm using custom messages like:

@NotBlank(message = "{validation.error.name.blank}")

Using this setup with Spring Boot 2.1.9 everything works fine and my messages are picked up correctly.
With 2.2.0 it shows "{validation.error.name.blank}" as a result. When there is no custom message on annotation: @NotBlank then it shows default message found in ValidationMessages.properties inside validation jar like "must not be blank".

In my WebMvcConfiguration I'm defining validator bean:

@Override
    public Validator getValidator() {
        LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
        validator.setValidationMessageSource(messageSource);
        return validator;
    }

I can't find if the is any change according to this in boot or spring framework 5.2

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