spring-projects/spring-framework · error · IllegalArgumentException
'targetMapClass' must not be null
Error message
'targetMapClass' must not be null
What it means
Error "'targetMapClass' must not be null" thrown in spring-projects/spring-framework.
Source
Thrown at spring-beans/src/main/java/org/springframework/beans/factory/config/MapFactoryBean.java:61
/**
* Set the source Map, typically populated via XML "map" elements.
*/
public void setSourceMap(Map<?, ?> sourceMap) {
this.sourceMap = sourceMap;
}
/**
* Set the class to use for the target Map. Can be populated with a fully
* qualified class name when defined in a Spring application context.
* <p>Default is a linked HashMap, keeping the registration order.
* @see java.util.LinkedHashMap
*/
@SuppressWarnings("rawtypes")
public void setTargetMapClass(@Nullable Class<? extends Map> targetMapClass) {
if (targetMapClass == null) {
throw new IllegalArgumentException("'targetMapClass' must not be null");
}
if (!Map.class.isAssignableFrom(targetMapClass)) {
throw new IllegalArgumentException("'targetMapClass' must implement [java.util.Map]");
}
this.targetMapClass = targetMapClass;
}
@Override
@SuppressWarnings("rawtypes")
public Class<Map> getObjectType() {
return Map.class;
}
@Override
@SuppressWarnings("unchecked")
protected Map<Object, Object> createInstance() {
if (this.sourceMap == null) {View on GitHub (pinned to e8729d0438)
When it happens
Trigger: Thrown at spring-beans/src/main/java/org/springframework/beans/factory/config/MapFactoryBean.java:61 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of spring-projects/spring-framework@e8729d0438 (2026-08-04).
Data as JSON: /data/errors/317ec6ed7dc64d5d.json.
Report an issue: GitHub.