-
Notifications
You must be signed in to change notification settings - Fork 41.9k
Closed
Labels
type: regressionA regression from a previous releaseA regression from a previous release
Milestone
Description
Spring Boot version: 4.0.1
Current Behavior with GraalVM Native Image
When doing Controller Bean Validation and injecting the BindingResult into the MVC template,
the field error default messages have not been interpolated. This used to work with Spring Boot 3.x native images.
Current Behavior with JVM
When running the application locally or with a non-native image the BindingResult error messages are interpolated correctly.
Expected Behavior
BindingResult error message interpolation should work correctly as it does with JVM.
Context
Here is a sample of the code I used to inject the BindingResult into the MVC template.
When logging the fieldError.getDefaultMessage() in the controller I can already see the error before the MCV template engine gets involved.
@PostMapping
public String addPerson(
@ModelAttribute @Valid Person person, BindingResult bindingResult, Model model) {
if (bindingResult.hasErrors()) {
for (FieldError fieldError : bindingResult.getFieldErrors()) {
log.error("error: {}", fieldError.getDefaultMessage());
}
model.addAttribute("result", bindingResult);
return "AddPerson";
}
PersonController.PERSON = person;
return "redirect:/person";
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
type: regressionA regression from a previous releaseA regression from a previous release