diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/result/view/AbstractView.java b/spring-webflux/src/main/java/org/springframework/web/reactive/result/view/AbstractView.java index a4d0801e5f..4234df9f31 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/result/view/AbstractView.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/result/view/AbstractView.java @@ -215,11 +215,19 @@ public abstract class AbstractView implements View, BeanNameAware, ApplicationCo protected Mono> getModelAttributes( @Nullable Map model, ServerWebExchange exchange) { - int size = (model != null ? model.size() : 0); - Map attributes = new ConcurrentHashMap<>(size); + Map attributes; if (model != null) { - attributes.putAll(model); + attributes = new ConcurrentHashMap<>(model.size()); + for (Map.Entry entry : model.entrySet()) { + if (entry.getValue() != null) { + attributes.put(entry.getKey(), entry.getValue()); + } + } } + else { + attributes = new ConcurrentHashMap<>(0); + } + //noinspection deprecation return resolveAsyncAttributes(attributes) .then(resolveAsyncAttributes(attributes, exchange))