diff --git a/spring-web/src/main/java/org/springframework/web/ErrorResponse.java b/spring-web/src/main/java/org/springframework/web/ErrorResponse.java
index 86c2d6472106..3f239de6e264 100644
--- a/spring-web/src/main/java/org/springframework/web/ErrorResponse.java
+++ b/spring-web/src/main/java/org/springframework/web/ErrorResponse.java
@@ -100,14 +100,15 @@ default Object[] getDetailMessageArguments(MessageSource messageSource, Locale l
*
By default this is initialized via
* {@link #getDefaultDetailMessageCode(Class, String)}.
*/
- default String getTitleCode() {
+ default String getTitleMessageCode() {
return getDefaultTitleMessageCode(getClass());
}
/**
* Resolve the {@link #getDetailMessageCode() detailMessageCode} and the
- * {@link #getTitleCode() titleCode} through the given {@link MessageSource},
- * and if found, update the "detail" and "title!" fields respectively.
+ * {@link #getTitleMessageCode() titleCode} through the given
+ * {@link MessageSource}, and if found, update the "detail" and "title!"
+ * fields respectively.
* @param messageSource the {@code MessageSource} to use for the lookup
* @param locale the {@code Locale} to use for the lookup
*/
@@ -118,7 +119,7 @@ default ProblemDetail updateAndGetBody(@Nullable MessageSource messageSource, Lo
if (detail != null) {
getBody().setDetail(detail);
}
- String title = messageSource.getMessage(getTitleCode(), null, null, locale);
+ String title = messageSource.getMessage(getTitleMessageCode(), null, null, locale);
if (title != null) {
getBody().setTitle(title);
}
diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/ResponseEntityExceptionHandler.java b/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/ResponseEntityExceptionHandler.java
index 61db9627eb8c..99f8e386fa3e 100644
--- a/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/ResponseEntityExceptionHandler.java
+++ b/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/ResponseEntityExceptionHandler.java
@@ -306,12 +306,11 @@ protected Mono> handleErrorResponseException(
* @return the created {@code ProblemDetail} instance
*/
protected ProblemDetail createProblemDetail(
- Exception ex, HttpStatusCode status, @Nullable HttpHeaders headers,
- String defaultDetail, @Nullable String detailMessageCode, @Nullable Object[] detailMessageArguments,
- ServerWebExchange exchange) {
+ Exception ex, HttpStatusCode status, String defaultDetail, @Nullable String detailMessageCode,
+ @Nullable Object[] detailMessageArguments, ServerWebExchange exchange) {
ErrorResponse response = ErrorResponse.createFor(
- ex, status, headers, defaultDetail, detailMessageCode, detailMessageArguments);
+ ex, status, null, defaultDetail, detailMessageCode, detailMessageArguments);
return response.updateAndGetBody(this.messageSource, getLocale(exchange));
}
diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/ResponseEntityExceptionHandlerTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/ResponseEntityExceptionHandlerTests.java
index 74c7ecc300db..777bfd7f931f 100644
--- a/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/ResponseEntityExceptionHandlerTests.java
+++ b/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/ResponseEntityExceptionHandlerTests.java
@@ -279,7 +279,7 @@ protected Mono> handleErrorResponseException(
public Mono> handleException(IllegalStateException ex, ServerWebExchange exchange) {
HttpStatus status = HttpStatus.INTERNAL_SERVER_ERROR;
- ProblemDetail body = createProblemDetail(ex, status, null, ex.getMessage(), null, new Object[] {"A"}, exchange);
+ ProblemDetail body = createProblemDetail(ex, status, ex.getMessage(), null, new Object[] {"A"}, exchange);
return handleExceptionInternal(ex, body, null, status, exchange);
}
}
diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ResponseEntityExceptionHandler.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ResponseEntityExceptionHandler.java
index ca596bb0c6f8..a30433a34941 100644
--- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ResponseEntityExceptionHandler.java
+++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ResponseEntityExceptionHandler.java
@@ -394,7 +394,7 @@ protected ResponseEntity