|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2024 the original author or authors. |
| 2 | + * Copyright 2002-2025 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
39 | 39 | import reactor.core.publisher.SynchronousSink;
|
40 | 40 | import reactor.core.scheduler.Scheduler;
|
41 | 41 |
|
| 42 | +import org.springframework.context.i18n.LocaleContextHolder; |
42 | 43 | import org.springframework.core.CoroutinesUtils;
|
43 | 44 | import org.springframework.core.DefaultParameterNameDiscoverer;
|
44 | 45 | import org.springframework.core.KotlinDetector;
|
@@ -186,8 +187,14 @@ public Mono<HandlerResult> invoke(
|
186 | 187 |
|
187 | 188 | return getMethodArgumentValuesOnScheduler(exchange, bindingContext, providedArgs).flatMap(args -> {
|
188 | 189 | if (shouldValidateArguments() && this.methodValidator != null) {
|
189 |
| - this.methodValidator.applyArgumentValidation( |
190 |
| - getBean(), getBridgedMethod(), getMethodParameters(), args, this.validationGroups); |
| 190 | + try { |
| 191 | + LocaleContextHolder.setLocaleContext(exchange.getLocaleContext()); |
| 192 | + this.methodValidator.applyArgumentValidation( |
| 193 | + getBean(), getBridgedMethod(), getMethodParameters(), args, this.validationGroups); |
| 194 | + } |
| 195 | + finally { |
| 196 | + LocaleContextHolder.resetLocaleContext(); |
| 197 | + } |
191 | 198 | }
|
192 | 199 | Object value;
|
193 | 200 | Method method = getBridgedMethod();
|
|
0 commit comments