Class NamedContextFactory<C extends NamedContextFactory.Specification>
java.lang.Object
org.springframework.cloud.context.named.NamedContextFactory<C>
- Type Parameters:
C- specification
- All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.DisposableBean, org.springframework.context.ApplicationContextAware
public abstract class NamedContextFactory<C extends NamedContextFactory.Specification>
extends Object
implements org.springframework.beans.factory.DisposableBean, org.springframework.context.ApplicationContextAware
Creates a set of child contexts that allows a set of Specifications to define the beans
in each child context. Ported from spring-cloud-netflix FeignClientFactory and
SpringClientFactory
- Author:
- Spencer Gibb, Dave Syer, Tommy Karlsson, Olga Maciaszek-Sharma
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceSpecification with name and configuration. -
Constructor Summary
ConstructorsConstructorDescriptionNamedContextFactory(Class<?> defaultConfigType, String propertySourceName, String propertyName) NamedContextFactory(Class<?> defaultConfigType, String propertySourceName, String propertyName, Map<String, org.springframework.context.ApplicationContextInitializer<org.springframework.context.support.GenericApplicationContext>> applicationContextInitializers) -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.context.support.GenericApplicationContextbuildContext(String name) org.springframework.context.support.GenericApplicationContextcreateContext(String name) voiddestroy()protected StringgenerateDisplayName(String name) <T> TgetAnnotatedInstance(String name, org.springframework.core.ResolvableType type, Class<? extends Annotation> annotationType) protected org.springframework.context.support.GenericApplicationContextgetContext(String name) <T> TgetInstance(String name, Class<?> clazz, Class<?>... generics) <T> @Nullable TgetInstance(String name, Class<T> type) <T> TgetInstance(String name, org.springframework.core.ResolvableType type) getInstances(String name, Class<T> type) <T> org.springframework.beans.factory.ObjectProvider<T> getLazyProvider(String name, Class<T> type) org.springframework.context.ApplicationContext<T> org.springframework.beans.factory.ObjectProvider<T> getProvider(String name, Class<T> type) voidregisterBeans(String name, org.springframework.context.support.GenericApplicationContext context) voidsetApplicationContext(org.springframework.context.ApplicationContext parent) voidsetConfigurations(List<C> configurations)
-
Constructor Details
-
NamedContextFactory
-
NamedContextFactory
-
-
Method Details
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext parent) throws org.springframework.beans.BeansException - Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Throws:
org.springframework.beans.BeansException
-
getParent
public org.springframework.context.ApplicationContext getParent() -
setConfigurations
-
getContextNames
-
destroy
public void destroy()- Specified by:
destroyin interfaceorg.springframework.beans.factory.DisposableBean
-
getContext
-
createContext
-
registerBeans
public void registerBeans(String name, org.springframework.context.support.GenericApplicationContext context) -
buildContext
-
generateDisplayName
-
getInstance
-
getLazyProvider
-
getProvider
-
getInstance
-
getInstance
-
getAnnotatedInstance
public <T> T getAnnotatedInstance(String name, org.springframework.core.ResolvableType type, Class<? extends Annotation> annotationType) -
getInstances
-
getConfigurations
-