spring-projects/spring-framework · error · IllegalArgumentException

'targetListClass' must not be null

Error message

'targetListClass' must not be null

What it means

Error "'targetListClass' must not be null" thrown in spring-projects/spring-framework.

Source

Thrown at spring-beans/src/main/java/org/springframework/beans/factory/config/ListFactoryBean.java:61


	/**
	 * Set the source List, typically populated via XML "list" elements.
	 */
	public void setSourceList(List<?> sourceList) {
		this.sourceList = sourceList;
	}

	/**
	 * Set the class to use for the target List. Can be populated with a fully
	 * qualified class name when defined in a Spring application context.
	 * <p>Default is a {@code java.util.ArrayList}.
	 * @see java.util.ArrayList
	 */
	@SuppressWarnings("rawtypes")
	public void setTargetListClass(@Nullable Class<? extends List> targetListClass) {
		if (targetListClass == null) {
			throw new IllegalArgumentException("'targetListClass' must not be null");
		}
		if (!List.class.isAssignableFrom(targetListClass)) {
			throw new IllegalArgumentException("'targetListClass' must implement [java.util.List]");
		}
		this.targetListClass = targetListClass;
	}


	@Override
	@SuppressWarnings("rawtypes")
	public Class<List> getObjectType() {
		return List.class;
	}

	@Override
	@SuppressWarnings("unchecked")
	protected List<Object> createInstance() {
		if (this.sourceList == null) {

View on GitHub (pinned to e8729d0438)

When it happens

Trigger: Thrown at spring-beans/src/main/java/org/springframework/beans/factory/config/ListFactoryBean.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/4fae935cbe505c3e.json. Report an issue: GitHub.