mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-09-17 12:09:16 +00:00
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:
+2
-2
@@ -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;
|
||||
}
|
||||
|
||||
+3
-1
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user