Merge pull request #48480 from ngocnhan-tran1996

* pr/48480:
  Allow Info to be built with null map values

Closes gh-48480
This commit is contained in:
Phillip Webb
2025-12-09 10:48:43 -08:00
2 changed files with 5 additions and 3 deletions
@@ -93,7 +93,7 @@ public final class Info {
*/
public static class Builder {
private final Map<String, Object> content;
private final Map<String, @Nullable Object> content;
public Builder() {
this.content = new LinkedHashMap<>();
@@ -116,7 +116,7 @@ public final class Info {
* @return this {@link Builder} instance
* @see #withDetail(String, Object)
*/
public Builder withDetails(Map<String, @Nullable ? extends Object> details) {
public Builder withDetails(Map<String, @Nullable Object> details) {
this.content.putAll(details);
return this;
}
@@ -19,6 +19,8 @@ package org.springframework.boot.actuate.info;
import java.util.LinkedHashMap;
import java.util.Map;
import org.jspecify.annotations.Nullable;
/**
* A simple {@link InfoContributor} that exposes a map.
*
@@ -27,7 +29,7 @@ import java.util.Map;
*/
public class MapInfoContributor implements InfoContributor {
private final Map<String, Object> info;
private final Map<String, @Nullable Object> info;
public MapInfoContributor(Map<String, Object> info) {
this.info = new LinkedHashMap<>(info);