Introduced AnnotationConfigRegistry as common interface for AnnotationConfig(Web)ApplicationContext

Issue: SPR-11814
This commit is contained in:
Juergen Hoeller
2014-06-26 11:43:03 +02:00
parent 591f79514d
commit b3e3c5312f
3 changed files with 59 additions and 16 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,6 +23,7 @@ import java.util.Set;
import org.springframework.beans.factory.support.BeanNameGenerator;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.context.annotation.AnnotatedBeanDefinitionReader;
import org.springframework.context.annotation.AnnotationConfigRegistry;
import org.springframework.context.annotation.AnnotationConfigUtils;
import org.springframework.context.annotation.ClassPathBeanDefinitionScanner;
import org.springframework.context.annotation.ScopeMetadataResolver;
@@ -78,7 +79,8 @@ import org.springframework.web.context.ContextLoader;
* @since 3.0
* @see org.springframework.context.annotation.AnnotationConfigApplicationContext
*/
public class AnnotationConfigWebApplicationContext extends AbstractRefreshableWebApplicationContext {
public class AnnotationConfigWebApplicationContext extends AbstractRefreshableWebApplicationContext
implements AnnotationConfigRegistry {
private BeanNameGenerator beanNameGenerator;
@@ -130,10 +132,8 @@ public class AnnotationConfigWebApplicationContext extends AbstractRefreshableWe
/**
* 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 {@code register} are idempotent; adding the same
* annotated class more than once has no additional effect.
* <p>Note that {@link #refresh()} must be called in order for the context
* to fully process the new classes.
* @param annotatedClasses one or more annotated classes,
* e.g. {@link org.springframework.context.annotation.Configuration @Configuration} classes
* @see #scan(String...)
@@ -148,8 +148,8 @@ public class AnnotationConfigWebApplicationContext extends AbstractRefreshableWe
/**
* Perform a scan within the specified base packages.
* Note that {@link #refresh()} must be called in order for the context to
* fully process the new class.
* <p>Note that {@link #refresh()} must be called in order for the context
* to fully process the new classes.
* @param basePackages the packages to check for annotated classes
* @see #loadBeanDefinitions(DefaultListableBeanFactory)
* @see #register(Class...)