commit
c591fab618
|
@ -145,7 +145,7 @@ public class WebFluxProperties {
|
||||||
public static class Problemdetails {
|
public static class Problemdetails {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether RFC 7807 Problem Details support should be enabled.
|
* Whether RFC 9457 Problem Details support should be enabled.
|
||||||
*/
|
*/
|
||||||
private boolean enabled = false;
|
private boolean enabled = false;
|
||||||
|
|
||||||
|
|
|
@ -428,7 +428,7 @@ public class WebMvcProperties {
|
||||||
public static class Problemdetails {
|
public static class Problemdetails {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether RFC 7807 Problem Details support should be enabled.
|
* Whether RFC 9457 Problem Details support should be enabled.
|
||||||
*/
|
*/
|
||||||
private boolean enabled = false;
|
private boolean enabled = false;
|
||||||
|
|
||||||
|
|
|
@ -181,7 +181,7 @@ For machine clients, it produces a JSON response with details of the error, the
|
||||||
For browser clients, there is a "`whitelabel`" error handler that renders the same data in HTML format.
|
For browser clients, there is a "`whitelabel`" error handler that renders the same data in HTML format.
|
||||||
You can also provide your own HTML templates to display errors (see the xref:web/reactive.adoc#web.reactive.webflux.error-handling.error-pages[next section]).
|
You can also provide your own HTML templates to display errors (see the xref:web/reactive.adoc#web.reactive.webflux.error-handling.error-pages[next section]).
|
||||||
|
|
||||||
Before customizing error handling in Spring Boot directly, you can leverage the {url-spring-framework-docs}/web/webflux/ann-rest-exceptions.html[RFC 7807 Problem Details] support in Spring WebFlux.
|
Before customizing error handling in Spring Boot directly, you can leverage the {url-spring-framework-docs}/web/webflux/ann-rest-exceptions.html[RFC 9457 Problem Details] support in Spring WebFlux.
|
||||||
Spring WebFlux can produce custom error messages with the `application/problem+json` media type, like:
|
Spring WebFlux can produce custom error messages with the `application/problem+json` media type, like:
|
||||||
|
|
||||||
[source,json]
|
[source,json]
|
||||||
|
|
|
@ -350,7 +350,7 @@ TIP: The `BasicErrorController` can be used as a base class for a custom `ErrorC
|
||||||
This is particularly useful if you want to add a handler for a new content type (the default is to handle `text/html` specifically and provide a fallback for everything else).
|
This is particularly useful if you want to add a handler for a new content type (the default is to handle `text/html` specifically and provide a fallback for everything else).
|
||||||
To do so, extend `BasicErrorController`, add a public method with a `@RequestMapping` that has a `produces` attribute, and create a bean of your new type.
|
To do so, extend `BasicErrorController`, add a public method with a `@RequestMapping` that has a `produces` attribute, and create a bean of your new type.
|
||||||
|
|
||||||
As of Spring Framework 6.0, {url-spring-framework-docs}/web/webmvc/mvc-ann-rest-exceptions.html[RFC 7807 Problem Details] is supported.
|
As of Spring Framework 6.0, {url-spring-framework-docs}/web/webmvc/mvc-ann-rest-exceptions.html[RFC 9457 Problem Details] is supported.
|
||||||
Spring MVC can produce custom error messages with the `application/problem+json` media type, like:
|
Spring MVC can produce custom error messages with the `application/problem+json` media type, like:
|
||||||
|
|
||||||
[source,json]
|
[source,json]
|
||||||
|
|
Loading…
Reference in New Issue