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 Classes Modifier and Type Class Description static interfaceNamedContextFactory.SpecificationSpecification with name and configuration.
-
Constructor Summary
Constructors Constructor Description NamedContextFactory(Class<?> defaultConfigType, String propertySourceName, String propertyName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.springframework.context.annotation.AnnotationConfigApplicationContextcreateContext(String name)voiddestroy()protected StringgenerateDisplayName(String name)protected org.springframework.context.annotation.AnnotationConfigApplicationContextgetContext(String name)Set<String>getContextNames()<T> TgetInstance(String name, Class<?> clazz, Class<?>... generics)<T> TgetInstance(String name, Class<T> type)<T> TgetInstance(String name, org.springframework.core.ResolvableType type)<T> Map<String,T>getInstances(String name, Class<T> type)<T> org.springframework.beans.factory.ObjectProvider<T>getLazyProvider(String name, Class<T> type)org.springframework.context.ApplicationContextgetParent()<T> org.springframework.beans.factory.ObjectProvider<T>getProvider(String name, Class<T> type)voidsetApplicationContext(org.springframework.context.ApplicationContext parent)voidsetConfigurations(List<C> configurations)
-
-
-
Method Detail
-
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()
-
destroy
public void destroy()
- Specified by:
destroyin interfaceorg.springframework.beans.factory.DisposableBean
-
getContext
protected org.springframework.context.annotation.AnnotationConfigApplicationContext getContext(String name)
-
createContext
protected org.springframework.context.annotation.AnnotationConfigApplicationContext createContext(String name)
-
getLazyProvider
public <T> org.springframework.beans.factory.ObjectProvider<T> getLazyProvider(String name, Class<T> type)
-
getProvider
public <T> org.springframework.beans.factory.ObjectProvider<T> getProvider(String name, Class<T> type)
-
getInstance
public <T> T getInstance(String name, org.springframework.core.ResolvableType type)
-
-