spring-boot
spring-boot copied to clipboard
EL-based validation message interpolation does not work when using MessageSource
Spring Boot: 3.3.2
messages.properties:
validation.password.length=Password must be at least {min} characters
bean validation annotation (AccountCreateRequest class):
@Size(min = 10, message = "{validation.password.length}")
private String password;
controller:
@PostMapping(path = "/")
public Account create(@RequestBody @Valid AccountCreateRequest request) {
...
}
when message is translated by MessageSource, the interpolation does not work:
instead of:
Password must be at least 10 characters
you get:
Password must be at least min characters
Thanks for the report. Unfortunately, it doesn't contain enough information for us to diagnose the problem. I assume you're using Bean Validation, but that's not 100% clear. It's also not clear how the validation is being driven. If you would like us to spend some more time investigating, please spend some time providing a complete yet minimal sample that reproduces the problem. You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to this issue.
@wilkinsona I have updated the original description with more information
@alan-czajkowski Unfortunately that's still not enough information for us to go on. We need a full sample that we can run ourselves so that we can see dependencies and all the code and configuration involved.
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.