Skip to content

Hibernate validation messages broken in spring boot 2.6.1 when setUseCodeAsDefaultMessage set to true #28930

Closed
@runningonfumes

Description

@runningonfumes

Configuring the following messageSource breaks hibernate validation messages

@Bean
public MessageSource messageSource() {
	var resourceBundleMessageSource = new ResourceBundleMessageSource();
	resourceBundleMessageSource.setUseCodeAsDefaultMessage(true);
	return resourceBundleMessageSource;
}

attached is a simple test case where the defaultMessage is the key, not the expected translation.

If that test is run against spring boot 2.5.7 it is fine, against 2.6.1 it is broken
demo.zip
.

Metadata

Metadata

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