Class DefaultConfigurationBeanAliasGenerator
- java.lang.Object
-
- io.microsphere.spring.beans.factory.support.DefaultConfigurationBeanAliasGenerator
-
- All Implemented Interfaces:
ConfigurationBeanAliasGenerator
public class DefaultConfigurationBeanAliasGenerator extends java.lang.Object implements ConfigurationBeanAliasGenerator
AConfigurationBeanAliasGenerator
implementation that generates configuration bean aliases by combining the simple name of the configuration class and the capitalized bean name.For example, if the configuration class is
com.example.config.AppConfig
and the bean name isdataSource
, the generated alias will be:AppConfigDataSource
.
-
-
Constructor Summary
Constructors Constructor Description DefaultConfigurationBeanAliasGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
generateAlias(java.lang.String prefix, java.lang.String beanName, java.lang.Class<?> configClass)
Generates an alias for a configuration bean based on the provided prefix, bean name, and configuration class.
-
-
-
Method Detail
-
generateAlias
public java.lang.String generateAlias(java.lang.String prefix, java.lang.String beanName, java.lang.Class<?> configClass)
Description copied from interface:ConfigurationBeanAliasGenerator
Generates an alias for a configuration bean based on the provided prefix, bean name, and configuration class.This method should create a unique and consistent alias by combining the given prefix, bean name, and the simple name of the configuration class. Implementations are expected to handle cases where any of the inputs may be
null
or empty, ensuring a valid alias is returned.Example: Given a prefix of "app", a bean name of "dataSource", and a configuration class named
DatabaseConfig
, this method might return:"appDataSourceDatabaseConfig"
.- Specified by:
generateAlias
in interfaceConfigurationBeanAliasGenerator
- Parameters:
prefix
- the prefix to be used in the alias; may benull
or emptybeanName
- the name of the bean for which the alias is being generated; must not benull
or emptyconfigClass
- the configuration class associated with the bean; may benull
if no specific configuration class is associated- Returns:
- a generated alias as a
String
; nevernull
-
-