Skip to content

Commit 37ab8a7

Browse files
committed
Doc: no "useCodeAsDefaultMessage" for setValidationMessageSource
Issue: SPR-15986
1 parent e49198d commit 37ab8a7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

spring-context/src/main/java/org/springframework/validation/beanvalidation/LocalValidatorFactoryBean.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -157,6 +157,11 @@ public void setMessageInterpolator(MessageInterpolator messageInterpolator) {
157157
* not both. If you would like to build a custom MessageInterpolator, consider deriving from
158158
* Hibernate Validator's {@link ResourceBundleMessageInterpolator} and passing in a
159159
* Spring-based {@code ResourceBundleLocator} when constructing your interpolator.
160+
* <p>In order for Hibernate's default validation messages to be resolved still, your
161+
* {@link MessageSource} must be configured for optional resolution (usually the default).
162+
* In particular, the {@code MessageSource} instance specified here should not apply
163+
* {@link org.springframework.context.support.AbstractMessageSource#setUseCodeAsDefaultMessage
164+
* "useCodeAsDefaultMessage"} behavior. Please double-check your setup accordingly.
160165
* @see ResourceBundleMessageInterpolator
161166
*/
162167
public void setValidationMessageSource(MessageSource messageSource) {

0 commit comments

Comments
 (0)