You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
WebMvcConfigurationSupport requestMappingHandlerAdapter()@Bean method takes no args. It calls WebMvcAutoConfiguration mvcValidator() which calls WebMvcConfigurerComposite getValidator() which calls the getValidator()@Override in my Configuration class, which creates a LocalValidatorFactoryBean setting the ValidationMessageSource to my ReloadableResourceBundleMessageSource messageSource.
Upshot:requestMappingHandlerAdapter configured with the userResourceBundleLocator set to MessageSourceResoureBundleLocator as expected.
Spring 5.2.0 behaviour:
WebMvcConfigurationSupport requestMappingHandlerAdapter()@Bean method now takes a Validator. It is instantiated with the "defaultValidator" LocalValidatorFactoryBean. That has a PlatformResourceBundleLocator as the userResourceBundleLocator.
Upshot:requestMappingHandlerAdapter configured with the userResourceBundleLocator set to PlatformResoureBundleLocator.
Subsequently, the mvcValidator()@Bean is instantiated, but too late for use in the requestMappingHandlerAdapter.
Thanks to the provided repro project, I can confirm that this is a regression introduced in 5.2 (at least in conjunction with Spring Boot).
Failed tests: testNumberTooHigh(example.ConstraintErrorIntegrationTest): expected:<[The number must not be more than 10]> but was:<[{test.api.simpleupdate.number.max}]>
Activity
sbrannen commentedon Oct 22, 2019
Hi @rgolder1,
Thanks for raising the issue.
Can you provide a minimal example that reproduces the exact issue you're encountering?
rgolder1 commentedon Oct 23, 2019
Hi Sam,
Here you go, replication steps are in the ReadMe:
https://github.com/rgolder1/error-handler-spring
Rob.
sbrannen commentedon Oct 23, 2019
Thanks for the repo project!
We'll look into it.
[-]Spring 5.2.0.RELEASE: Resource bundle message source custom validation message no longer resolved[/-][+]Regression: Resource bundle message source custom validation message no longer resolved[/+]sbrannen commentedon Oct 23, 2019
Thanks to the provided repro project, I can confirm that this is a regression introduced in 5.2 (at least in conjunction with Spring Boot).
Example test case for spring-projectsgh-23839
sbrannen commentedon Oct 28, 2019
In light of spring-projects/spring-boot#18672 (comment), I am closing this issue.
sbrannen commentedon Oct 31, 2019
Please note that this issue is a duplicate of spring-projects/spring-boot#18672 (comment) (in Spring Boot) and was superseded by #23887 (in Spring Framework).
Thus, the "fix" for this issue is the combination of the fixes in spring-projects/spring-boot#18672 (comment) and #23887.