From 84a63b6d4bfbfd0d5f1e91786802b68f9cd1411a Mon Sep 17 00:00:00 2001 From: Chris Beams Date: Fri, 6 May 2011 19:01:11 +0000 Subject: [PATCH] Prevent empty calls to ACAC #register and #scan --- .../context/annotation/AnnotationConfigApplicationContext.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/org.springframework.context/src/main/java/org/springframework/context/annotation/AnnotationConfigApplicationContext.java b/org.springframework.context/src/main/java/org/springframework/context/annotation/AnnotationConfigApplicationContext.java index 38f369992a..a9762efcd5 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/annotation/AnnotationConfigApplicationContext.java +++ b/org.springframework.context/src/main/java/org/springframework/context/annotation/AnnotationConfigApplicationContext.java @@ -19,6 +19,7 @@ package org.springframework.context.annotation; import org.springframework.beans.factory.support.BeanNameGenerator; import org.springframework.context.support.GenericApplicationContext; import org.springframework.core.env.ConfigurableEnvironment; +import org.springframework.util.Assert; /** * Standalone application context, accepting annotated classes as input - in particular @@ -126,6 +127,7 @@ public class AnnotationConfigApplicationContext extends GenericApplicationContex * @see #refresh() */ public void register(Class... annotatedClasses) { + Assert.notEmpty(annotatedClasses, "At least one annotated class must be specified"); this.reader.register(annotatedClasses); } @@ -137,6 +139,7 @@ public class AnnotationConfigApplicationContext extends GenericApplicationContex * @see #refresh() */ public void scan(String... basePackages) { + Assert.notEmpty(basePackages, "At least one base package must be specified"); this.scanner.scan(basePackages); }