Merge branch '6.2.x'
This commit is contained in:
@@ -71,23 +71,25 @@ import org.springframework.core.annotation.AliasFor;
|
||||
*
|
||||
* <p>The following return types are supported for handler methods:
|
||||
* <ul>
|
||||
* <li>A {@code ModelAndView} object (from Servlet MVC).
|
||||
* <li>A {@link org.springframework.ui.Model} object, with the view name implicitly
|
||||
* <li>{@code ModelAndView} object (from Servlet MVC).
|
||||
* <li>{@link org.springframework.ui.Model} object, with the view name implicitly
|
||||
* determined through a {@link org.springframework.web.servlet.RequestToViewNameTranslator}.
|
||||
* <li>A {@link java.util.Map} object for exposing a model,
|
||||
* <li>{@link java.util.Map} object for exposing a model,
|
||||
* with the view name implicitly determined through a
|
||||
* {@link org.springframework.web.servlet.RequestToViewNameTranslator}.
|
||||
* <li>A {@link org.springframework.web.servlet.View} object.
|
||||
* <li>A {@link String} value which is interpreted as view name.
|
||||
* <li>{@link org.springframework.web.servlet.View} object.
|
||||
* <li>{@link String} value which is interpreted as view name.
|
||||
* <li>{@link ResponseBody @ResponseBody} annotated methods (Servlet-only)
|
||||
* to set the response content. The return value will be converted to the
|
||||
* response stream using
|
||||
* {@linkplain org.springframework.http.converter.HttpMessageConverter message converters}.
|
||||
* <li>An {@link org.springframework.http.HttpEntity HttpEntity<?>} or
|
||||
* <li>{@link org.springframework.http.HttpEntity HttpEntity<?>} or
|
||||
* {@link org.springframework.http.ResponseEntity ResponseEntity<?>} object
|
||||
* (Servlet-only) to set response headers and content. The ResponseEntity body
|
||||
* will be converted and written to the response stream using
|
||||
* {@linkplain org.springframework.http.converter.HttpMessageConverter message converters}.
|
||||
* <li>{@link org.springframework.http.ProblemDetail} or {@link org.springframework.web.ErrorResponse}
|
||||
* object to render an RFC 9457 error response with details in the body.
|
||||
* <li>{@code void} if the method handles the response itself (by
|
||||
* writing the response content directly, declaring an argument of type
|
||||
* {@link jakarta.servlet.ServletResponse} / {@link jakarta.servlet.http.HttpServletResponse}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
* Copyright 2002-2025 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.
|
||||
@@ -26,18 +26,16 @@ import java.lang.annotation.Target;
|
||||
import org.springframework.core.annotation.AliasFor;
|
||||
|
||||
/**
|
||||
* A convenience annotation that is itself annotated with
|
||||
* {@link ControllerAdvice @ControllerAdvice}
|
||||
* and {@link ResponseBody @ResponseBody}.
|
||||
* A shortcut annotation that combines {@link ControllerAdvice @ControllerAdvice}
|
||||
* with {@link ResponseBody @ResponseBody}, in effect simply an
|
||||
* {@code @ControllerAdvice} whose exception handler methods render to the
|
||||
* response body.
|
||||
*
|
||||
* <p>Types that carry this annotation are treated as controller advice where
|
||||
* {@link ExceptionHandler @ExceptionHandler} methods assume
|
||||
* {@link ResponseBody @ResponseBody} semantics by default.
|
||||
* <p>By default, {@code @RestControllerAdvice} applies to any controller,
|
||||
* including {@code @Controller} and {@code @RestController}. Use attributes of
|
||||
* the annotation to apply more specific filtering criteria.
|
||||
*
|
||||
* <p><b>NOTE:</b> {@code @RestControllerAdvice} is processed if an appropriate
|
||||
* {@code HandlerMapping}-{@code HandlerAdapter} pair is configured such as the
|
||||
* {@code RequestMappingHandlerMapping}-{@code RequestMappingHandlerAdapter} pair
|
||||
* which are the default in the MVC Java config and the MVC namespace.
|
||||
* <p>See {@link ControllerAdvice} for more details.
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
* @author Sam Brannen
|
||||
|
||||
Reference in New Issue
Block a user