Search in sources :

Example 1 with CasMongoOperations

use of org.apereo.cas.mongo.CasMongoOperations in project cas by apereo.

the class MongoDbMonitoringConfiguration method mongoHealthIndicator.

@Bean
@RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
@ConditionalOnEnabledHealthIndicator("mongoHealthIndicator")
@ConditionalOnMissingBean(name = "mongoHealthIndicator")
public HealthIndicator mongoHealthIndicator(final CasConfigurationProperties casProperties, @Qualifier("mongoHealthIndicatorTemplate") final BeanContainer<CasMongoOperations> mongoHealthIndicatorTemplate) {
    val warn = casProperties.getMonitor().getWarn();
    val results = mongoHealthIndicatorTemplate.toList().stream().map(template -> new MongoDbHealthIndicator(template, warn.getEvictionThreshold(), warn.getThreshold())).collect(Collectors.toList());
    return new CompositeHealthIndicator(results);
}
Also used : lombok.val(lombok.val) CasConfigurationProperties(org.apereo.cas.configuration.CasConfigurationProperties) ConditionalOnEnabledHealthIndicator(org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) MongoDbHealthIndicator(org.apereo.cas.monitor.MongoDbHealthIndicator) MongoDbConnectionFactory(org.apereo.cas.mongo.MongoDbConnectionFactory) lombok.val(lombok.val) ScopedProxyMode(org.springframework.context.annotation.ScopedProxyMode) CasMongoOperations(org.apereo.cas.mongo.CasMongoOperations) HealthIndicator(org.springframework.boot.actuate.health.HealthIndicator) Collectors(java.util.stream.Collectors) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) Configuration(org.springframework.context.annotation.Configuration) BeanContainer(org.apereo.cas.util.spring.beans.BeanContainer) EnableConfigurationProperties(org.springframework.boot.context.properties.EnableConfigurationProperties) CasSSLContext(org.apereo.cas.authentication.CasSSLContext) Qualifier(org.springframework.beans.factory.annotation.Qualifier) CompositeHealthIndicator(org.apereo.cas.monitor.CompositeHealthIndicator) Bean(org.springframework.context.annotation.Bean) CompositeHealthIndicator(org.apereo.cas.monitor.CompositeHealthIndicator) MongoDbHealthIndicator(org.apereo.cas.monitor.MongoDbHealthIndicator) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) ConditionalOnEnabledHealthIndicator(org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

Collectors (java.util.stream.Collectors)1 lombok.val (lombok.val)1 CasSSLContext (org.apereo.cas.authentication.CasSSLContext)1 CasConfigurationProperties (org.apereo.cas.configuration.CasConfigurationProperties)1 CasMongoOperations (org.apereo.cas.mongo.CasMongoOperations)1 MongoDbConnectionFactory (org.apereo.cas.mongo.MongoDbConnectionFactory)1 CompositeHealthIndicator (org.apereo.cas.monitor.CompositeHealthIndicator)1 MongoDbHealthIndicator (org.apereo.cas.monitor.MongoDbHealthIndicator)1 BeanContainer (org.apereo.cas.util.spring.beans.BeanContainer)1 Qualifier (org.springframework.beans.factory.annotation.Qualifier)1 ConditionalOnEnabledHealthIndicator (org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator)1 HealthIndicator (org.springframework.boot.actuate.health.HealthIndicator)1 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)1 EnableConfigurationProperties (org.springframework.boot.context.properties.EnableConfigurationProperties)1 RefreshScope (org.springframework.cloud.context.config.annotation.RefreshScope)1 Bean (org.springframework.context.annotation.Bean)1 Configuration (org.springframework.context.annotation.Configuration)1 ScopedProxyMode (org.springframework.context.annotation.ScopedProxyMode)1