Class MonitoringAutoConfiguration
java.lang.Object
com.nmontytskyi.monitoring.starter.config.MonitoringAutoConfiguration
@AutoConfiguration
@ConditionalOnProperty(prefix="monitoring",
name="enabled",
havingValue="true",
matchIfMissing=true)
@EnableAspectJAutoProxy
@EnableScheduling
@EnableConfigurationProperties(MonitoringProperties.class)
public class MonitoringAutoConfiguration
extends Object
Auto-configuration for the monitoring starter.
Activated in two ways:
- Via
META-INF/spring/AutoConfiguration.imports— usesapplication.ymlproperties under themonitoring.*prefix. - Via
@MonitoredMicroserviceon the main application class — annotation attribute values are registered as the lowest-priorityPropertySourcebyMonitoredMicroserviceEnvironmentPostProcessorbefore any bean processing takes place, soapplication.ymlalways overrides them.
The cascade is: annotation defaults → overridden by YAML → overridden by system properties.
This means @ConditionalOnProperty, @Scheduled, and @ConfigurationProperties
all see the correct effective value without any special handling here.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionallEndpointsAspect(MetricsBuffer buffer, ServiceRegistrationBean registrationBean) metricsBuffer(MonitoringProperties props, MonitoringServerClient client) org.springframework.scheduling.annotation.SchedulingConfigurermetricsBufferScheduler(MetricsBuffer buffer, MonitoringProperties props) Drives the periodic flush ofMetricsBufferat the configured interval.monitoredEndpointAspect(ServiceRegistrationBean registrationBean, MonitoringServerClient client) serviceRegistrationBean(MonitoringServerClient client, MonitoringProperties props, org.springframework.core.env.Environment environment) trackMetricAspect(MetricsBuffer buffer, ServiceRegistrationBean registrationBean)
-
Constructor Details
-
MonitoringAutoConfiguration
public MonitoringAutoConfiguration()
-
-
Method Details
-
monitoringServerClient
@Bean @ConditionalOnMissingBean public MonitoringServerClient monitoringServerClient(MonitoringProperties props) -
serviceRegistrationBean
@Bean @ConditionalOnMissingBean public ServiceRegistrationBean serviceRegistrationBean(MonitoringServerClient client, MonitoringProperties props, org.springframework.core.env.Environment environment) -
monitoredEndpointAspect
@Bean @ConditionalOnMissingBean public MonitoredEndpointAspect monitoredEndpointAspect(ServiceRegistrationBean registrationBean, MonitoringServerClient client) -
metricsBuffer
@Bean @ConditionalOnMissingBean public MetricsBuffer metricsBuffer(MonitoringProperties props, MonitoringServerClient client) -
trackMetricAspect
@Bean @ConditionalOnMissingBean public TrackMetricAspect trackMetricAspect(MetricsBuffer buffer, ServiceRegistrationBean registrationBean) -
allEndpointsAspect
@Bean @ConditionalOnProperty(prefix="monitoring", name="track-all-endpoints", havingValue="true") @ConditionalOnMissingBean public AllEndpointsAspect allEndpointsAspect(MetricsBuffer buffer, ServiceRegistrationBean registrationBean) -
metricsBufferScheduler
@Bean @ConditionalOnMissingBean(org.springframework.scheduling.annotation.SchedulingConfigurer.class) public org.springframework.scheduling.annotation.SchedulingConfigurer metricsBufferScheduler(MetricsBuffer buffer, MonitoringProperties props) Drives the periodic flush ofMetricsBufferat the configured interval. UsingSchedulingConfigurerreads the interval from the fully-boundMonitoringPropertiesbean rather than a raw property string, so the annotation's default is applied correctly when no YAML override is present.
-