spring-projects/spring-framework · error · IllegalArgumentException

IntroductionInfo defines no interfaces to introduce: {introd

Error message

IntroductionInfo defines no interfaces to introduce: {introductionInfo}

What it means

DefaultIntroductionAdvisor constructor throws IllegalArgumentException when the supplied IntroductionInfo reports zero interfaces via getInterfaces(). An introduction must add at least one interface to the proxy; an empty interface set leaves nothing to introduce and is treated as a programming error.

Source

Thrown at spring-aop/src/main/java/org/springframework/aop/support/DefaultIntroductionAdvisor.java:74

	 * @see #addInterface
	 */
	public DefaultIntroductionAdvisor(Advice advice) {
		this(advice, (advice instanceof IntroductionInfo introductionInfo ? introductionInfo : null));
	}

	/**
	 * Create a DefaultIntroductionAdvisor for the given advice.
	 * @param advice the Advice to apply
	 * @param introductionInfo the IntroductionInfo that describes
	 * the interface to introduce (may be {@code null})
	 */
	public DefaultIntroductionAdvisor(Advice advice, @Nullable IntroductionInfo introductionInfo) {
		Assert.notNull(advice, "Advice must not be null");
		this.advice = advice;
		if (introductionInfo != null) {
			Class<?>[] introducedInterfaces = introductionInfo.getInterfaces();
			if (introducedInterfaces.length == 0) {
				throw new IllegalArgumentException(
						"IntroductionInfo defines no interfaces to introduce: " + introductionInfo);
			}
			for (Class<?> ifc : introducedInterfaces) {
				addInterface(ifc);
			}
		}
	}

	/**
	 * Create a DefaultIntroductionAdvisor for the given advice.
	 * @param advice the Advice to apply
	 * @param ifc the interface to introduce
	 */
	public DefaultIntroductionAdvisor(DynamicIntroductionAdvice advice, Class<?> ifc) {
		Assert.notNull(advice, "Advice must not be null");
		this.advice = advice;
		addInterface(ifc);
	}

View on GitHub (pinned to e8729d0438)

Solutions

  1. Ensure the IntroductionInfo (or IntroductionInfoSupport delegate) reports at least one interface.
  2. Use the DefaultIntroductionAdvisor(DynamicIntroductionAdvice, Class) constructor to name the interface explicitly.
  3. Make the delegate class implement the interface you intend to introduce.

Example fix

// before
public class EmptyIntro implements IntroductionInfo {
  public Class<?>[] getInterfaces() { return new Class<?>[0]; }
}
new DefaultIntroductionAdvisor(advice, new EmptyIntro()); // -> error 116

// after
public class ServiceIntro extends DelegatingIntroductionInterceptor implements Lockable { ... }
new DefaultIntroductionAdvisor(new ServiceIntro());
Defensive patterns

Strategy: validation

Validate before calling

IntroductionInfo info = ...;
if (info == null || info.getInterfaces() == null || info.getInterfaces().length == 0) {
    throw new IllegalArgumentException("IntroductionInfo must declare >= 1 interface");
}

Type guard

boolean hasInterfaces(IntroductionInfo info) {
    return info != null && info.getInterfaces() != null && info.getInterfaces().length > 0;
}

Prevention

When it happens

Trigger: new DefaultIntroductionAdvisor(advice, introductionInfo) where introductionInfo.getInterfaces() returns a zero-length array.

Common situations: Subclassing DelegatingIntroductionInterceptor/IntroductionInfoSupport without populating the interface map; passing a custom IntroductionInfo that lazily computes interfaces but returns empty at construction; delegate object implementing no interfaces.

Related errors


AI-assisted analysis of spring-projects/spring-framework@e8729d0438 (2026-08-04). Data as JSON: /data/errors/c29d18bad3815b7a.json. Report an issue: GitHub.