From 4d57f5043e03eba427a5f49b1f1cc06600295a5f Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Fri, 29 May 2020 15:49:36 +0200 Subject: [PATCH] Document that MapPropertySource should not contain null values Closes gh-25142 --- .../springframework/core/env/MapPropertySource.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/spring-core/src/main/java/org/springframework/core/env/MapPropertySource.java b/spring-core/src/main/java/org/springframework/core/env/MapPropertySource.java index d08c6fb27844..36597a5b24a5 100644 --- a/spring-core/src/main/java/org/springframework/core/env/MapPropertySource.java +++ b/spring-core/src/main/java/org/springframework/core/env/MapPropertySource.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2020 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. @@ -23,6 +23,8 @@ /** * {@link PropertySource} that reads keys and values from a {@code Map} object. + * The underlying map should not contain any {@code null} values in order to + * comply with {@link #getProperty} and {@link #containsProperty} semantics. * * @author Chris Beams * @author Juergen Hoeller @@ -31,6 +33,12 @@ */ public class MapPropertySource extends EnumerablePropertySource> { + /** + * Create a new {@code MapPropertySource} with the given name and {@code Map}. + * @param name the associated name + * @param source the Map source (without {@code null} values in order to get + * consistent {@link #getProperty} and {@link #containsProperty} behavior) + */ public MapPropertySource(String name, Map source) { super(name, source); }