spring-projects/spring-framework · error · UnsupportedOperationException

Element access not supported - for custom ObjectProvider cla

Error message

Element access not supported - for custom ObjectProvider classes, implement stream() to enable all other methods

What it means

Error "Element access not supported - for custom ObjectProvider classes, implement stream() to enable all other methods" thrown in spring-projects/spring-framework.

Source

Thrown at spring-beans/src/main/java/org/springframework/beans/factory/ObjectProvider.java:237

	 */
	@Override
	default Iterator<T> iterator() {
		return stream().iterator();
	}

	/**
	 * Return a sequential {@link Stream} over all matching object instances,
	 * without specific ordering guarantees (but typically in registration order).
	 * <p>Note: The result may be filtered by default according to qualifiers on the
	 * injection point versus target beans and the general autowire candidate status
	 * of matching beans. For custom filtering against type-matching candidates, use
	 * {@link #stream(Predicate)} instead (potentially with {@link #UNFILTERED}).
	 * @since 5.1
	 * @see #iterator()
	 * @see #orderedStream()
	 */
	default Stream<T> stream() {
		throw new UnsupportedOperationException("Element access not supported - " +
				"for custom ObjectProvider classes, implement stream() to enable all other methods");
	}

	/**
	 * Return a sequential {@link Stream} over all matching object instances,
	 * pre-ordered according to the factory's common order comparator.
	 * <p>In a standard Spring application context, this will be ordered
	 * according to {@link org.springframework.core.Ordered} conventions,
	 * and in case of annotation-based configuration also considering the
	 * {@link org.springframework.core.annotation.Order} annotation,
	 * analogous to multi-element injection points of list/array type.
	 * <p>The default method applies an {@link OrderComparator} to the
	 * {@link #stream()} method. You may override this to apply an
	 * {@link org.springframework.core.annotation.AnnotationAwareOrderComparator}
	 * if necessary.
	 * <p>Note: The result may be filtered by default according to qualifiers on the
	 * injection point versus target beans and the general autowire candidate status
	 * of matching beans. For custom filtering against type-matching candidates, use

View on GitHub (pinned to e8729d0438)

When it happens

Trigger: Thrown at spring-beans/src/main/java/org/springframework/beans/factory/ObjectProvider.java:237 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/6df61f38fd93992c.json. Report an issue: GitHub.