AnnotationConfigWebApplicationContext allows for repeated register/scan calls

Restoring consistency with AnnotationConfigApplicationContext.

Issue: SPR-10852
(cherry picked from commit 01b8d93)
This commit is contained in:
Juergen Hoeller
2013-08-28 00:04:53 +02:00
parent 8a1ae53166
commit 5a49d657d8
2 changed files with 58 additions and 92 deletions

View File

@@ -109,7 +109,7 @@ public class AnnotationConfigApplicationContext extends GenericApplicationContex
public void setBeanNameGenerator(BeanNameGenerator beanNameGenerator) {
this.reader.setBeanNameGenerator(beanNameGenerator);
this.scanner.setBeanNameGenerator(beanNameGenerator);
this.getBeanFactory().registerSingleton(
getBeanFactory().registerSingleton(
AnnotationConfigUtils.CONFIGURATION_BEAN_NAME_GENERATOR, beanNameGenerator);
}
@@ -126,9 +126,9 @@ public class AnnotationConfigApplicationContext extends GenericApplicationContex
/**
* Register one or more annotated classes to be processed.
* Note that {@link #refresh()} must be called in order for the context to fully
* process the new class.
* <p>Calls to {@link #register} are idempotent; adding the same
* Note that {@link #refresh()} must be called in order for the context
* to fully process the new class.
* <p>Calls to {@code register} are idempotent; adding the same
* annotated class more than once has no additional effect.
* @param annotatedClasses one or more annotated classes,
* e.g. {@link Configuration @Configuration} classes