Browse Source

Prevent empty calls to ACAC #register and #scan

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4252 50f2f4bb-b051-0410-bef5-90022cba6387
pull/1/merge
Chris Beams 15 years ago
parent
commit
8bc5338de6
  1. 3
      org.springframework.context/src/main/java/org/springframework/context/annotation/AnnotationConfigApplicationContext.java

3
org.springframework.context/src/main/java/org/springframework/context/annotation/AnnotationConfigApplicationContext.java

@ -19,6 +19,7 @@ package org.springframework.context.annotation; @@ -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 @@ -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 @@ -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);
}

Loading…
Cancel
Save