@@ -751,18 +751,21 @@ To configure the severity order, add the following property to your application
751
751
management.endpoint.health.status.order=fatal,down,out-of-service,unknown,up
752
752
----
753
753
754
- The HTTP status code in the response reflects the overall health status (for example, `UP` maps to 200, while `OUT_OF_SERVICE` and `DOWN` map to 503).
754
+ The HTTP status code in the response reflects the overall health status.
755
+ By default, `OUT_OF_SERVICE` and `DOWN` map to 503.
756
+ Any unmapped health statuses, including `UP`, map to 200.
755
757
You might also want to register custom status mappings if you access the health endpoint over HTTP.
756
- For example, the following property maps `FATAL` to 503 (service unavailable):
758
+ Configuring a custom mapping disables the defaults mappings for `DOWN` and `OUT_OF_SERVICE`.
759
+ If you want to retain the default mappings they must be configured explicitly alongside any custom mappings.
760
+ For example, the following property maps `FATAL` to 503 (service unavailable) and retains the default mappings for `DOWN` and `OUT_OF_SERVICE`:
757
761
758
762
[source,properties,indent=0,configprops]
759
763
----
764
+ management.endpoint.health.status.http-mapping.down=503
760
765
management.endpoint.health.status.http-mapping.fatal=503
766
+ management.endpoint.health.status.http-mapping.out-of-service=503
761
767
----
762
768
763
- WARNING: A custom status mapping replaces whole of the default status mappings.
764
- That means the above example has only one mapping to `FATAL` and any other statuses will return the http status 200 as `UNKNOWN` health status.
765
-
766
769
TIP: If you need more control, you can define your own `HttpCodeStatusMapper` bean.
767
770
768
771
The following table shows the default status mappings for the built-in statuses:
@@ -864,7 +867,7 @@ It's also possible to override the `show-details` and `roles` properties if requ
864
867
management.endpoint.health.group.custom.roles=admin
865
868
management.endpoint.health.group.custom.status.order=fatal,up
866
869
management.endpoint.health.group.custom.status.http-mapping.fatal=500
867
-
870
+ management.endpoint.health.group.custom.status.http-mapping.out-of-service=500
868
871
----
869
872
870
873
TIP: You can use `@Qualifier("groupname")` if you need to register custom `StatusAggregator` or `HttpCodeStatusMapper` beans for use with the group.
0 commit comments