Search in sources :

Example 1 with ConditionalOnMissingBean

use of org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean in project spring-boot-admin by codecentric.

the class AdminServerCoreConfiguration method statusUpdater.

@Bean
@ConditionalOnMissingBean
public StatusUpdater statusUpdater(ApplicationStore applicationStore, ApplicationOperations applicationOperations) {
    StatusUpdater statusUpdater = new StatusUpdater(applicationStore, applicationOperations);
    statusUpdater.setStatusLifetime(adminServerProperties.getMonitor().getStatusLifetime());
    return statusUpdater;
}
Also used : StatusUpdater(de.codecentric.boot.admin.registry.StatusUpdater) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 2 with ConditionalOnMissingBean

use of org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean in project spring-boot-admin by codecentric.

the class DiscoveryClientConfiguration method applicationDiscoveryListener.

@Bean
@ConditionalOnMissingBean
@ConfigurationProperties(prefix = "spring.boot.admin.discovery")
public ApplicationDiscoveryListener applicationDiscoveryListener(ServiceInstanceConverter serviceInstanceConverter) {
    ApplicationDiscoveryListener listener = new ApplicationDiscoveryListener(discoveryClient, registry);
    listener.setConverter(serviceInstanceConverter);
    return listener;
}
Also used : ApplicationDiscoveryListener(de.codecentric.boot.admin.discovery.ApplicationDiscoveryListener) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConfigurationProperties(org.springframework.boot.context.properties.ConfigurationProperties) ConditionalOnBean(org.springframework.boot.autoconfigure.condition.ConditionalOnBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 3 with ConditionalOnMissingBean

use of org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean in project spring-boot-admin by codecentric.

the class SpringBootAdminClientAutoConfiguration method registrationListener.

@Bean
@ConditionalOnMissingBean
public RegistrationApplicationListener registrationListener(AdminProperties admin, ApplicationRegistrator registrator) {
    RegistrationApplicationListener listener = new RegistrationApplicationListener(registrator, registrationTaskScheduler());
    listener.setAutoRegister(admin.isAutoRegistration());
    listener.setAutoDeregister(admin.isAutoDeregistration());
    listener.setRegisterPeriod(admin.getPeriod());
    return listener;
}
Also used : RegistrationApplicationListener(de.codecentric.boot.admin.client.registration.RegistrationApplicationListener) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 4 with ConditionalOnMissingBean

use of org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean in project cas by apereo.

the class CasCoreAuthenticationConfiguration method authenticationEventExecutionPlan.

@ConditionalOnMissingBean(name = "authenticationEventExecutionPlan")
@Autowired
@Bean
public AuthenticationEventExecutionPlan authenticationEventExecutionPlan(final List<AuthenticationEventExecutionPlanConfigurer> configurers) {
    final DefaultAuthenticationEventExecutionPlan plan = new DefaultAuthenticationEventExecutionPlan();
    configurers.forEach(c -> {
        final String name = StringUtils.removePattern(c.getClass().getSimpleName(), "\\$.+");
        LOGGER.debug("Configuring authentication execution plan [{}]", name);
        c.configureAuthenticationExecutionPlan(plan);
    });
    return plan;
}
Also used : DefaultAuthenticationEventExecutionPlan(org.apereo.cas.authentication.DefaultAuthenticationEventExecutionPlan) Autowired(org.springframework.beans.factory.annotation.Autowired) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 5 with ConditionalOnMissingBean

use of org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean in project cas by apereo.

the class CasCoreMonitorConfiguration method healthCheckMonitor.

@ConditionalOnMissingBean(name = "healthCheckMonitor")
@Bean
public Monitor healthCheckMonitor() {
    final Map<String, Monitor> beans = applicationContext.getBeansOfType(Monitor.class, false, true);
    final Set<Monitor> monitors = beans.entrySet().stream().map(Map.Entry::getValue).collect(Collectors.toSet());
    final int freeMemThreshold = casProperties.getMonitor().getFreeMemThreshold();
    if (freeMemThreshold > 0) {
        monitors.add(new MemoryMonitor(freeMemThreshold));
    }
    final MonitorProperties.Warn warn = casProperties.getMonitor().getSt().getWarn();
    if (warn.getThreshold() > 0) {
        final SessionMonitor bean = new SessionMonitor(ticketRegistry, warn.getThreshold(), warn.getThreshold());
        monitors.add(bean);
    }
    return new HealthCheckMonitor(monitors);
}
Also used : MemoryMonitor(org.apereo.cas.monitor.MemoryMonitor) HealthCheckMonitor(org.apereo.cas.monitor.HealthCheckMonitor) SessionMonitor(org.apereo.cas.monitor.SessionMonitor) Monitor(org.apereo.cas.monitor.Monitor) MemoryMonitor(org.apereo.cas.monitor.MemoryMonitor) HealthCheckMonitor(org.apereo.cas.monitor.HealthCheckMonitor) Map(java.util.Map) SessionMonitor(org.apereo.cas.monitor.SessionMonitor) MonitorProperties(org.apereo.cas.configuration.model.core.monitor.MonitorProperties) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)807 Bean (org.springframework.context.annotation.Bean)807 ConditionalOnBean (org.springframework.boot.autoconfigure.condition.ConditionalOnBean)339 ConditionalOnClass (org.springframework.boot.autoconfigure.condition.ConditionalOnClass)298 RefreshScope (org.springframework.cloud.context.config.annotation.RefreshScope)251 Lazy (org.springframework.context.annotation.Lazy)227 lombok.val (lombok.val)210 HashMap (java.util.HashMap)190 Map (java.util.Map)113 CamelContextAware (org.apache.camel.CamelContextAware)69 RuntimeCamelException (org.apache.camel.RuntimeCamelException)45 DataFormatFactory (org.apache.camel.spi.DataFormatFactory)45 EnableConfigurationProperties (org.springframework.boot.context.properties.EnableConfigurationProperties)29 Scope (org.springframework.context.annotation.Scope)26 Autowired (org.springframework.beans.factory.annotation.Autowired)23 Configuration (org.springframework.context.annotation.Configuration)21 Qualifier (org.springframework.beans.factory.annotation.Qualifier)20 DefaultChainingMultifactorAuthenticationBypassProvider (org.apereo.cas.authentication.bypass.DefaultChainingMultifactorAuthenticationBypassProvider)19 CasConfigurationProperties (org.apereo.cas.configuration.CasConfigurationProperties)19 AuthenticationMultifactorAuthenticationProviderBypassEvaluator (org.apereo.cas.authentication.bypass.AuthenticationMultifactorAuthenticationProviderBypassEvaluator)17