Class AnnotatedPropertySourceLoader<A extends Annotation>
java.lang.Object
io.microsphere.spring.context.annotation.BeanCapableImportCandidate
io.microsphere.spring.config.context.annotation.AnnotatedPropertySourceLoader<A>
- Type Parameters:
A
- The type ofAnnotation
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanClassLoaderAware
,org.springframework.beans.factory.BeanFactoryAware
,org.springframework.context.annotation.ImportSelector
,org.springframework.context.EnvironmentAware
,org.springframework.context.ResourceLoaderAware
- Direct Known Subclasses:
PropertySourceExtensionLoader
public abstract class AnnotatedPropertySourceLoader<A extends Annotation>
extends BeanCapableImportCandidate
implements org.springframework.context.annotation.ImportSelector
Abstract
ImportSelector
class to load the PropertySource
when the configuration
annotated the specified annotation- Since:
- 1.0.0
- Author:
- Mercy
- See Also:
-
ResourcePropertySourceLoader
PropertySourceExtensionLoader
ImportSelector
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final io.microsphere.logging.Logger
protected static final String
Fields inherited from class io.microsphere.spring.context.annotation.BeanCapableImportCandidate
beanFactory, classLoader, environment, resourceLoader
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected String
buildDefaultPropertySourceName
(org.springframework.core.annotation.AnnotationAttributes attributes, org.springframework.core.type.AnnotationMetadata metadata) Build the default name ofPropertySource
protected String
buildPropertySourceName
(org.springframework.core.annotation.AnnotationAttributes attributes, org.springframework.core.type.AnnotationMetadata metadata) Build the name ofPropertySource
The annotation typeprotected String
protected abstract void
loadPropertySource
(org.springframework.core.annotation.AnnotationAttributes attributes, org.springframework.core.type.AnnotationMetadata metadata, String propertySourceName, org.springframework.core.env.MutablePropertySources propertySources) Load thePropertySource
protected final String
resolvePropertySourceName
(org.springframework.core.annotation.AnnotationAttributes attributes, org.springframework.core.type.AnnotationMetadata metadata) Resolve the name ofPropertySource
final String[]
selectImports
(org.springframework.core.type.AnnotationMetadata metadata) Methods inherited from class io.microsphere.spring.context.annotation.BeanCapableImportCandidate
getBeanFactory, getClassLoader, getEnvironment, getResourceLoader, setBeanClassLoader, setBeanFactory, setEnvironment, setResourceLoader
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.context.annotation.ImportSelector
getExclusionFilter
-
Field Details
-
NAME_ATTRIBUTE_NAME
- See Also:
-
logger
protected final io.microsphere.logging.Logger logger
-
-
Constructor Details
-
AnnotatedPropertySourceLoader
public AnnotatedPropertySourceLoader()
-
-
Method Details
-
resolveAnnotationType
-
selectImports
- Specified by:
selectImports
in interfaceorg.springframework.context.annotation.ImportSelector
-
resolvePropertySourceName
@Nonnull protected final String resolvePropertySourceName(org.springframework.core.annotation.AnnotationAttributes attributes, org.springframework.core.type.AnnotationMetadata metadata) Resolve the name ofPropertySource
- Parameters:
attributes
-AnnotationAttributes
metadata
-AnnotationMetadata
- Returns:
- non-null
-
buildPropertySourceName
@Nullable protected String buildPropertySourceName(org.springframework.core.annotation.AnnotationAttributes attributes, org.springframework.core.type.AnnotationMetadata metadata) Build the name ofPropertySource
- Parameters:
attributes
-AnnotationAttributes
metadata
-AnnotationMetadata
- Returns:
- the attribute value of annotation if the
"name"
attribute present, ornull
-
buildDefaultPropertySourceName
@Nonnull protected String buildDefaultPropertySourceName(org.springframework.core.annotation.AnnotationAttributes attributes, org.springframework.core.type.AnnotationMetadata metadata) Build the default name ofPropertySource
- Parameters:
attributes
-AnnotationAttributes
metadata
-AnnotationMetadata
- Returns:
- non-null
-
loadPropertySource
@Nullable protected abstract void loadPropertySource(org.springframework.core.annotation.AnnotationAttributes attributes, org.springframework.core.type.AnnotationMetadata metadata, String propertySourceName, org.springframework.core.env.MutablePropertySources propertySources) throws Throwable Load thePropertySource
- Parameters:
attributes
-AnnotationAttributes
metadata
-AnnotationMetadata
propertySourceName
- the name ofPropertySource
propertySources
-MutablePropertySources
to be added- Throws:
Throwable
- the failure of the loading
-
getAnnotationType
The annotation type- Returns:
- non-null
-
getPropertySourceName
-