类 PropertySourceExtensionLoader<A extends java.lang.annotation.Annotation,EA extends PropertySourceExtensionAttributes<A>>
- java.lang.Object
-
- io.microsphere.spring.context.annotation.BeanCapableImportCandidate
-
- io.microsphere.spring.config.context.annotation.AnnotatedPropertySourceLoader<A>
-
- io.microsphere.spring.config.context.annotation.PropertySourceExtensionLoader<A,EA>
-
- 类型参数:
A
- The type ofAnnotation
must meta-annotatePropertySourceExtension
EA
- ThePropertySourceExtensionAttributes
or its subtype
- 所有已实现的接口:
org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanClassLoaderAware
,org.springframework.beans.factory.BeanFactoryAware
,org.springframework.context.annotation.ImportSelector
,org.springframework.context.ApplicationContextAware
,org.springframework.context.EnvironmentAware
,org.springframework.context.ResourceLoaderAware
- 直接已知子类:
ResourcePropertySourceLoader
public abstract class PropertySourceExtensionLoader<A extends java.lang.annotation.Annotation,EA extends PropertySourceExtensionAttributes<A>> extends AnnotatedPropertySourceLoader<A> implements org.springframework.context.ApplicationContextAware
AbstractImportSelector
class to load thePropertySource
when theconfiguration
annotated the Enable annotation that meta-annotates@PropertySourceExtension
- 从以下版本开始:
- 1.0.0
- 作者:
- Mercy
- 另请参阅:
PropertySourceExtension
,PropertySourceExtensionAttributes
,ImportSelector
-
-
嵌套类概要
嵌套类 修饰符和类型 类 说明 protected static class
PropertySourceExtensionLoader.PropertySourceResource
The resource ofPropertySource
protected static interface
PropertySourceExtensionLoader.ResourcePropertySourcesRefresher
The Refresher ofPropertySources'
forResource
-
字段概要
-
从类继承的字段 io.microsphere.spring.config.context.annotation.AnnotatedPropertySourceLoader
logger, NAME_ATTRIBUTE_NAME
-
从类继承的字段 io.microsphere.spring.context.annotation.BeanCapableImportCandidate
beanFactory, classLoader, environment, resourceLoader
-
-
构造器概要
构造器 构造器 说明 PropertySourceExtensionLoader()
-
方法概要
所有方法 实例方法 抽象方法 具体方法 修饰符和类型 方法 说明 protected void
addPropertySource(EA extensionAttributes, org.springframework.core.env.MutablePropertySources propertySources, org.springframework.core.env.PropertySource<?> propertySource)
protected EA
buildExtensionAttributes(java.lang.Class<A> annotationType, java.lang.Class<EA> extensionAttributesType, org.springframework.core.annotation.AnnotationAttributes attributes, org.springframework.core.env.ConfigurableEnvironment environment)
Builds an instance ofPropertySourceExtensionLoader
protected void
configureResourcePropertySourcesRefresher(EA extensionAttributes, java.util.List<PropertySourceExtensionLoader.PropertySourceResource> propertySourceResources, org.springframework.core.env.CompositePropertySource propertySource, PropertySourceExtensionLoader.ResourcePropertySourcesRefresher refresher)
Configure thePropertySourceExtensionLoader.ResourcePropertySourcesRefresher
ofPropertySource
Resources
whenPropertySourceExtension.autoRefreshed()
istrue
protected <T> T
createInstance(EA extensionAttributes, java.util.function.Function<EA,java.lang.Class<T>> classFunction)
protected org.springframework.core.io.support.PropertySourceFactory
createPropertySourceFactory(EA extensionAttributes)
Creates an instance ofPropertySourceFactory
protected java.util.Comparator<org.springframework.core.io.Resource>
createResourceComparator(EA extensionAttributes, java.lang.String propertySourceName)
Creates an instance ofComparator
forResource
protected io.microsphere.spring.config.context.annotation.PropertySourceExtensionLoader.ResourcePropertySource
createResourcePropertySource(EA extensionAttributes, java.lang.String propertySourceName, org.springframework.core.io.support.PropertySourceFactory factory, PropertySourceExtensionLoader.PropertySourceResource propertySourceResource)
Create an instance ofPropertySourceExtensionLoader.ResourcePropertySource
for the specifiedresource
protected java.lang.String
createResourcePropertySourceName(java.lang.String propertySourceName, java.lang.String resourceValue, org.springframework.core.io.Resource resource)
java.lang.Class<EA>
getExtensionAttributesType()
Get the type ofPropertySourceExtensionLoader
boolean
isResourcePattern(java.lang.String resourceValue)
Test the resource value is pattern or notprotected org.springframework.core.env.PropertySource<?>
loadPropertySource(EA extensionAttributes, java.lang.String propertySourceName)
protected void
loadPropertySource(org.springframework.core.annotation.AnnotationAttributes attributes, org.springframework.core.type.AnnotationMetadata metadata, java.lang.String propertySourceName, org.springframework.core.env.MutablePropertySources propertySources)
Load thePropertySource
protected java.lang.Class<EA>
resolveExtensionAttributesType()
protected java.util.List<PropertySourceExtensionLoader.PropertySourceResource>
resolvePropertySourceResources(EA extensionAttributes, java.lang.String propertySourceName, java.lang.String resourceValue, java.util.Comparator<org.springframework.core.io.Resource> resourceComparator)
protected abstract org.springframework.core.io.Resource[]
resolveResources(EA extensionAttributes, java.lang.String propertySourceName, java.lang.String resourceValue)
Resolve the given resource value(s) to bePropertySourceExtensionLoader.PropertySourceResource
array.void
setApplicationContext(org.springframework.context.ApplicationContext context)
-
从类继承的方法 io.microsphere.spring.config.context.annotation.AnnotatedPropertySourceLoader
buildDefaultPropertySourceName, buildPropertySourceName, getAnnotationType, getPropertySourceName, resolveAnnotationType, resolvePropertySourceName, selectImports
-
从类继承的方法 io.microsphere.spring.context.annotation.BeanCapableImportCandidate
getBeanFactory, getClassLoader, getEnvironment, getResourceLoader, setBeanClassLoader, setBeanFactory, setEnvironment, setResourceLoader
-
-
-
-
方法详细资料
-
resolveExtensionAttributesType
protected java.lang.Class<EA> resolveExtensionAttributesType()
-
isResourcePattern
public boolean isResourcePattern(java.lang.String resourceValue)
Test the resource value is pattern or not- 参数:
resourceValue
- theString
value presenting resource- 返回:
true
ifresourceValue
is a pattern value
-
getExtensionAttributesType
public final java.lang.Class<EA> getExtensionAttributesType()
Get the type ofPropertySourceExtensionLoader
- 返回:
- non-null
- 另请参阅:
PropertySourceExtensionAttributes
-
loadPropertySource
protected final void loadPropertySource(org.springframework.core.annotation.AnnotationAttributes attributes, org.springframework.core.type.AnnotationMetadata metadata, java.lang.String propertySourceName, org.springframework.core.env.MutablePropertySources propertySources) throws java.lang.Throwable
从类复制的说明:AnnotatedPropertySourceLoader
Load thePropertySource
- 指定者:
loadPropertySource
在类中AnnotatedPropertySourceLoader<A extends java.lang.annotation.Annotation>
- 参数:
attributes
-AnnotationAttributes
metadata
-AnnotationMetadata
propertySourceName
- the name ofPropertySource
propertySources
-MutablePropertySources
to be added- 抛出:
java.lang.Throwable
- the failure of the loading
-
addPropertySource
protected void addPropertySource(EA extensionAttributes, org.springframework.core.env.MutablePropertySources propertySources, org.springframework.core.env.PropertySource<?> propertySource)
- 参数:
extensionAttributes
- theannotation attributes
ofPropertySourceExtension
propertySources
- theMutablePropertySources
to be addedpropertySource
- thePropertySource
is about to add
-
buildExtensionAttributes
protected EA buildExtensionAttributes(java.lang.Class<A> annotationType, java.lang.Class<EA> extensionAttributesType, org.springframework.core.annotation.AnnotationAttributes attributes, org.springframework.core.env.ConfigurableEnvironment environment) throws java.lang.Throwable
Builds an instance ofPropertySourceExtensionLoader
- 参数:
annotationType
- the type ofPropertySourceExtensionLoader
extensionAttributesType
- the type ofPropertySourceExtensionLoader
attributes
-AnnotationAttributes
environment
-ConfigurableEnvironment
- 返回:
- non-null
- 抛出:
java.lang.Throwable
-
loadPropertySource
protected final org.springframework.core.env.PropertySource<?> loadPropertySource(EA extensionAttributes, java.lang.String propertySourceName) throws java.lang.Throwable
- 抛出:
java.lang.Throwable
-
resolvePropertySourceResources
protected java.util.List<PropertySourceExtensionLoader.PropertySourceResource> resolvePropertySourceResources(EA extensionAttributes, java.lang.String propertySourceName, java.lang.String resourceValue, java.util.Comparator<org.springframework.core.io.Resource> resourceComparator) throws java.lang.Throwable
- 抛出:
java.lang.Throwable
-
createPropertySourceFactory
@NonNull protected org.springframework.core.io.support.PropertySourceFactory createPropertySourceFactory(EA extensionAttributes)
Creates an instance ofPropertySourceFactory
- 参数:
extensionAttributes
- theannotation attributes
ofPropertySourceExtension
- 返回:
- 另请参阅:
PropertySourceExtension.factory()
,PropertySourceFactory
-
createResourceComparator
@NonNull protected java.util.Comparator<org.springframework.core.io.Resource> createResourceComparator(EA extensionAttributes, java.lang.String propertySourceName)
Creates an instance ofComparator
forResource
- 参数:
extensionAttributes
- theannotation attributes
ofPropertySourceExtension
propertySourceName
- the name of {PropertySource} declared byPropertySourceExtension.name()
- 返回:
- an instance of
Comparator
forResource
- 另请参阅:
PropertySourceExtension.resourceComparator()
,Comparator
-
createResourcePropertySourceName
protected java.lang.String createResourcePropertySourceName(java.lang.String propertySourceName, java.lang.String resourceValue, org.springframework.core.io.Resource resource)
-
createResourcePropertySource
protected final io.microsphere.spring.config.context.annotation.PropertySourceExtensionLoader.ResourcePropertySource createResourcePropertySource(EA extensionAttributes, java.lang.String propertySourceName, org.springframework.core.io.support.PropertySourceFactory factory, PropertySourceExtensionLoader.PropertySourceResource propertySourceResource) throws java.lang.Throwable
Create an instance ofPropertySourceExtensionLoader.ResourcePropertySource
for the specifiedresource
- 参数:
extensionAttributes
- theannotation attributes
ofPropertySourceExtension
propertySourceName
- the name of {PropertySource} declared byPropertySourceExtension.name()
factory
- the factory to thePropertySource
declared byPropertySourceExtension.factory()
propertySourceResource
- the source ofPropertySource
- 返回:
- an instance of
PropertySourceExtensionLoader.ResourcePropertySource
- 抛出:
java.lang.Throwable
-
configureResourcePropertySourcesRefresher
protected void configureResourcePropertySourcesRefresher(EA extensionAttributes, java.util.List<PropertySourceExtensionLoader.PropertySourceResource> propertySourceResources, org.springframework.core.env.CompositePropertySource propertySource, PropertySourceExtensionLoader.ResourcePropertySourcesRefresher refresher) throws java.lang.Throwable
Configure thePropertySourceExtensionLoader.ResourcePropertySourcesRefresher
ofPropertySource
Resources
whenPropertySourceExtension.autoRefreshed()
istrue
- 参数:
extensionAttributes
- theannotation attributes
ofPropertySourceExtension
propertySourceResources
- The sorted list of the resolvedresources
propertySource
- Theproperty source
of current loader to be added into the Spring'sproperty sources
refresher
- The Refresher ofPropertySources'
Resource
- 抛出:
java.lang.Throwable
- any error
-
resolveResources
@Nullable protected abstract org.springframework.core.io.Resource[] resolveResources(EA extensionAttributes, java.lang.String propertySourceName, java.lang.String resourceValue) throws java.lang.Throwable
Resolve the given resource value(s) to bePropertySourceExtensionLoader.PropertySourceResource
array.- 参数:
extensionAttributes
-PropertySourceExtensionLoader
propertySourceName
-PropertySourceExtension.name()
resourceValue
- the resource value to resolve- 返回:
- nullable
- 抛出:
java.lang.Throwable
-
createInstance
protected <T> T createInstance(EA extensionAttributes, java.util.function.Function<EA,java.lang.Class<T>> classFunction)
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext context)
- 指定者:
setApplicationContext
在接口中org.springframework.context.ApplicationContextAware
-
-