Add AnnotationConfigApplicationContext constructor
Add AnnotationConfigApplicationContext constructor allow use of a custom DefaultListableBeanFactory. Issue: SPR-10529
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2012 the original author or authors.
|
* Copyright 2002-2013 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -17,6 +17,7 @@
|
|||||||
package org.springframework.context.annotation;
|
package org.springframework.context.annotation;
|
||||||
|
|
||||||
import org.springframework.beans.factory.support.BeanNameGenerator;
|
import org.springframework.beans.factory.support.BeanNameGenerator;
|
||||||
|
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||||
import org.springframework.context.support.GenericApplicationContext;
|
import org.springframework.context.support.GenericApplicationContext;
|
||||||
import org.springframework.core.env.ConfigurableEnvironment;
|
import org.springframework.core.env.ConfigurableEnvironment;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
@@ -61,6 +62,16 @@ public class AnnotationConfigApplicationContext extends GenericApplicationContex
|
|||||||
this.scanner = new ClassPathBeanDefinitionScanner(this);
|
this.scanner = new ClassPathBeanDefinitionScanner(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new AnnotationConfigApplicationContext with the given DefaultListableBeanFactory.
|
||||||
|
* @param beanFactory the DefaultListableBeanFactory instance to use for this context
|
||||||
|
*/
|
||||||
|
public AnnotationConfigApplicationContext(DefaultListableBeanFactory beanFactory) {
|
||||||
|
super(beanFactory);
|
||||||
|
this.reader = new AnnotatedBeanDefinitionReader(this);
|
||||||
|
this.scanner = new ClassPathBeanDefinitionScanner(this);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new AnnotationConfigApplicationContext, deriving bean definitions
|
* Create a new AnnotationConfigApplicationContext, deriving bean definitions
|
||||||
* from the given annotated classes and automatically refreshing the context.
|
* from the given annotated classes and automatically refreshing the context.
|
||||||
|
|||||||
Reference in New Issue
Block a user