From 37ab8a700bd790ed9428a0c707ded7766f674772 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Fri, 26 Jan 2018 10:35:37 +0100 Subject: [PATCH] Doc: no "useCodeAsDefaultMessage" for setValidationMessageSource Issue: SPR-15986 --- .../beanvalidation/LocalValidatorFactoryBean.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/spring-context/src/main/java/org/springframework/validation/beanvalidation/LocalValidatorFactoryBean.java b/spring-context/src/main/java/org/springframework/validation/beanvalidation/LocalValidatorFactoryBean.java index 004f167c28..fbb2f2e606 100644 --- a/spring-context/src/main/java/org/springframework/validation/beanvalidation/LocalValidatorFactoryBean.java +++ b/spring-context/src/main/java/org/springframework/validation/beanvalidation/LocalValidatorFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -157,6 +157,11 @@ public class LocalValidatorFactoryBean extends SpringValidatorAdapter * not both. If you would like to build a custom MessageInterpolator, consider deriving from * Hibernate Validator's {@link ResourceBundleMessageInterpolator} and passing in a * Spring-based {@code ResourceBundleLocator} when constructing your interpolator. + *

In order for Hibernate's default validation messages to be resolved still, your + * {@link MessageSource} must be configured for optional resolution (usually the default). + * In particular, the {@code MessageSource} instance specified here should not apply + * {@link org.springframework.context.support.AbstractMessageSource#setUseCodeAsDefaultMessage + * "useCodeAsDefaultMessage"} behavior. Please double-check your setup accordingly. * @see ResourceBundleMessageInterpolator */ public void setValidationMessageSource(MessageSource messageSource) {