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:
-
ResourcePropertySourceLoaderPropertySourceExtensionLoaderImportSelector
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final io.microsphere.logging.Loggerprotected static final StringFields inherited from class io.microsphere.spring.context.annotation.BeanCapableImportCandidate
beanFactory, classLoader, environment, resourceLoader -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringbuildDefaultPropertySourceName(org.springframework.core.annotation.AnnotationAttributes attributes, org.springframework.core.type.AnnotationMetadata metadata) Build the default name ofPropertySourceprotected StringbuildPropertySourceName(org.springframework.core.annotation.AnnotationAttributes attributes, org.springframework.core.type.AnnotationMetadata metadata) Build the name ofPropertySourceThe annotation typeprotected Stringprotected abstract voidloadPropertySource(org.springframework.core.annotation.AnnotationAttributes attributes, org.springframework.core.type.AnnotationMetadata metadata, String propertySourceName, org.springframework.core.env.MutablePropertySources propertySources) Load thePropertySourceprotected final StringresolvePropertySourceName(org.springframework.core.annotation.AnnotationAttributes attributes, org.springframework.core.type.AnnotationMetadata metadata) Resolve the name ofPropertySourcefinal 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, setResourceLoaderMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
selectImportsin 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-AnnotationAttributesmetadata-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-AnnotationAttributesmetadata-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-AnnotationAttributesmetadata-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-AnnotationAttributesmetadata-AnnotationMetadatapropertySourceName- the name ofPropertySourcepropertySources-MutablePropertySourcesto be added- Throws:
Throwable- the failure of the loading
-
getAnnotationType
The annotation type- Returns:
- non-null
-
getPropertySourceName
-