-
Notifications
You must be signed in to change notification settings - Fork 30
io microsphere spring cloud client actuator ConfigurationPropertyHasFeaturesAutoConfiguration
Type: Class | Module: microsphere-spring-cloud-commons | Package: io.microsphere.spring.cloud.client.actuator | Since: 1.0.0
Auto-registrar for Spring Cloud Client Actuator's HasFeatures based on configuration properties.
This class scans configuration properties under the prefix #PROPERTY_PREFIX to automatically register
HasFeatures beans. It supports two types of feature definitions:
- **Abstract Features:** Defined by listing feature classes directly under a module name.
- **Named Features:** Defined by mapping a specific feature name to a feature class under a module name.
`# Defines abstract features for the 'jdbc' module microsphere.spring.cloud.features.jdbc=org.springframework.jdbc.core.JdbcTemplate,org.springframework.transaction.PlatformTransactionManager `
`# Defines a named feature 'rest-template' for the 'web' module microsphere.spring.cloud.features.web.rest-template=org.springframework.web.client.RestTemplate `
For each module found in the configuration, a HasFeatures bean is registered with the name format:
HasFeatures.{module-name} (e.g., jdbc.features, web.features).
public class ConfigurationPropertyHasFeaturesAutoConfiguration implements BeanFactoryAware, BeanClassLoaderAware,Author: Mercy
-
Introduced in:
1.0.0 -
Current Project Version:
0.2.18-SNAPSHOT
This component is tested and compatible with the following Java versions:
| Java Version | Status |
|---|---|
| Java 17 | ✅ Compatible |
| Java 21 | ✅ Compatible |
| Java 25 | ✅ Compatible |
# Defines abstract features for the 'jdbc' module
microsphere.spring.cloud.features.jdbc=org.springframework.jdbc.core.JdbcTemplate,org.springframework.transaction.PlatformTransactionManager# Defines a named feature 'rest-template' for the 'web' module
microsphere.spring.cloud.features.web.rest-template=org.springframework.web.client.RestTemplate// For module name "jdbc"
String propertyName = getAbstractFeaturePropertyName("jdbc");
// Result: "microsphere.spring.cloud.features.jdbc"// For module name "web" and feature name "rest-template"
String propertyName = getNamedFeaturePropertyName("web", "rest-template");
// Result: "microsphere.spring.cloud.features.web.rest-template"// For module name "jdbc"
String beanName = getBeanName("jdbc");
// Result: "jdbc.features"// For module name "web" and feature name "rest-template"
String qualifiedName = getQualifierFeatureName("web", "rest-template");
// Result: "microsphere.web.rest-template"Add the following dependency to your pom.xml:
<dependency>
<groupId>io.github.microsphere-projects</groupId>
<artifactId>microsphere-spring-cloud-commons</artifactId>
<version>${microsphere-spring-cloud.version}</version>
</dependency>Tip: Use the BOM (
microsphere-spring-cloud-dependencies) for consistent version management. See the Getting Started guide.
import io.microsphere.spring.cloud.client.actuator.ConfigurationPropertyHasFeaturesAutoConfiguration;| Method | Description |
|---|---|
getAbstractFeaturePropertyName |
The prefix of the configuration properties for HasFeatures : "microsphere.spring.cloud.features." |
getNamedFeaturePropertyName |
Gets the configuration property name for a named feature of the specified module. |
getBeanName |
Gets the bean name for HasFeatures of the specified module. |
getQualifierFeatureName |
Gets the qualified feature name for a named feature of the specified module. |
public static String getAbstractFeaturePropertyName(String moduleName)The prefix of the configuration properties for HasFeatures : "microsphere.spring.cloud.features."
/
public static final String PROPERTY_PREFIX = MICROSPHERE_SPRING_CLOUD_PROPERTY_NAME_PREFIX + NAME + DOT;
/** The pattern of the configuration properties for abstract features: "microsphere.spring.cloud.features.{module-name}" / public static final String ABSTRACT_FEATURE_PROPERTY_NAME_PATTERN = PROPERTY_PREFIX + "{}";
/** The pattern of the configuration properties for named features: "microsphere.spring.cloud.features.{module-name}.{feature-name}" / public static final String NAMED_FEATURE_PROPERTY_NAME_PATTERN = ABSTRACT_FEATURE_PROPERTY_NAME_PATTERN + DOT + "{}";
/**
The suffix of the bean name for HasFeatures : ".features"
/
public static final String BEAN_NAME_SUFFIX = DOT + NAME;
private ClassLoader classLoader;
private SingletonBeanRegistry singletonBeanRegistry;
private final Map moduleFeaturesMap = newLinkedHashMap();
public static String getNamedFeaturePropertyName(String moduleName, String featureName)Gets the configuration property name for a named feature of the specified module.
`// For module name "web" and feature name "rest-template"
String propertyName = getNamedFeaturePropertyName("web", "rest-template");
// Result: "microsphere.spring.cloud.features.web.rest-template"
`
public static String getBeanName(String moduleName)Gets the bean name for HasFeatures of the specified module.
`// For module name "jdbc"
String beanName = getBeanName("jdbc");
// Result: "jdbc.features"
`
public static String getQualifierFeatureName(String moduleName, String featureName)Gets the qualified feature name for a named feature of the specified module.
`// For module name "web" and feature name "rest-template"
String qualifiedName = getQualifierFeatureName("web", "rest-template");
// Result: "microsphere.web.rest-template"
`
HasFeaturesNamedFeatureAutoRegistrationBean
This documentation was auto-generated from the source code of microsphere-spring-cloud.
spring-cloud-commons
- AbstractServiceRegistrationEndpoint
- CommonsPropertyConstants
- ConditionalOnAutoServiceRegistrationAvailable
- ConditionalOnAutoServiceRegistrationEnabled
- ConditionalOnBlockingDiscoveryAvailable
- ConditionalOnFeaturesAvailable
- ConditionalOnFeaturesEnabled
- ConditionalOnLoadBalancerEnabled
- ConditionalOnMultipleRegistrationEnabled
- ConditionalOnReactiveDiscoveryAvailable
- ConditionalOnUtilEnabled
- ConfigurationPropertyHasFeaturesAutoConfiguration
- DefaultRegistration
- DiscoveryClientAutoConfiguration
- DiscoveryClientConstants
- DiscoveryUtils
- EventPublishingRegistrationAspect
- FaultTolerancePropertyConstants
- InMemoryServiceRegistry
- InstanceConstants
- LoadBalancerUtils
- MultipleAutoServiceRegistration
- MultipleRegistration
- MultipleServiceRegistry
- ReactiveDiscoveryClientAdapter
- ReactiveDiscoveryClientAutoConfiguration
- RegistrationCustomizer
- RegistrationDeregisteredEvent
- RegistrationEvent
- RegistrationMetaData
- RegistrationPreDeregisteredEvent
- RegistrationPreRegisteredEvent
- RegistrationRegisteredEvent
- ServiceDeregistrationEndpoint
- ServiceInstanceUtils
- ServiceInstancesChangedEvent
- ServiceRegistrationEndpoint
- ServiceRegistrationEndpointAutoConfiguration
- ServiceRegistryAutoConfiguration
- SimpleAutoServiceRegistration
- SimpleAutoServiceRegistrationAutoConfiguration
- SimpleServiceRegistry
- SpecificationAutoConfiguration
- SpecificationBeanPostProcessor
- SpecificationCustomizer
- SpringCloudPropertyConstants
- TomcatDynamicConfigurationListener
- TomcatFaultToleranceAutoConfiguration
- UnionDiscoveryClient
- WebFluxServiceRegistryAutoConfiguration
- WebMvcServiceRegistryAutoConfiguration
- WebServiceRegistryAutoConfiguration
- WeightedRoundRobin
spring-cloud-openfeign
- AutoRefreshCapability
- AutoRefreshCapabilityCustomizer
- CompositedRequestInterceptor
- DecoratedContract
- DecoratedDecoder
- DecoratedEncoder
- DecoratedErrorDecoder
- DecoratedFeignComponent
- DecoratedQueryMapEncoder
- DecoratedRetryer
- EnableFeignAutoRefresh
- FeignAutoConfiguration
- FeignClientAutoRefreshAutoConfiguration
- FeignClientConfigurationChangedListener
- FeignComponentRegistry
- NoOpRequestInterceptor
- Refreshable