Add @ConditionalOnAvailableEndpoint value alias
Closes gh-41969
This commit is contained in:
parent
73f71d5560
commit
f832dcfbdc
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -34,7 +34,7 @@ import org.springframework.context.annotation.Bean;
|
|||
* @since 2.0.0
|
||||
*/
|
||||
@AutoConfiguration(after = AuditAutoConfiguration.class)
|
||||
@ConditionalOnAvailableEndpoint(endpoint = AuditEventsEndpoint.class)
|
||||
@ConditionalOnAvailableEndpoint(AuditEventsEndpoint.class)
|
||||
public class AuditEventsEndpointAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -31,7 +31,7 @@ import org.springframework.context.annotation.Bean;
|
|||
* @since 2.0.0
|
||||
*/
|
||||
@AutoConfiguration
|
||||
@ConditionalOnAvailableEndpoint(endpoint = BeansEndpoint.class)
|
||||
@ConditionalOnAvailableEndpoint(BeansEndpoint.class)
|
||||
public class BeansEndpointAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ import org.springframework.context.annotation.Bean;
|
|||
*/
|
||||
@AutoConfiguration(after = CacheAutoConfiguration.class)
|
||||
@ConditionalOnClass(CacheManager.class)
|
||||
@ConditionalOnAvailableEndpoint(endpoint = CachesEndpoint.class)
|
||||
@ConditionalOnAvailableEndpoint(CachesEndpoint.class)
|
||||
public class CachesEndpointAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -32,7 +32,7 @@ import org.springframework.context.annotation.Bean;
|
|||
* @since 2.0.0
|
||||
*/
|
||||
@AutoConfiguration
|
||||
@ConditionalOnAvailableEndpoint(endpoint = ConditionsReportEndpoint.class)
|
||||
@ConditionalOnAvailableEndpoint(ConditionsReportEndpoint.class)
|
||||
public class ConditionsReportEndpointAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -30,7 +30,7 @@ import org.springframework.context.annotation.Bean;
|
|||
* @since 2.0.0
|
||||
*/
|
||||
@AutoConfiguration
|
||||
@ConditionalOnAvailableEndpoint(endpoint = ShutdownEndpoint.class)
|
||||
@ConditionalOnAvailableEndpoint(ShutdownEndpoint.class)
|
||||
public class ShutdownEndpointAutoConfiguration {
|
||||
|
||||
@Bean(destroyMethod = "")
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ import org.springframework.context.annotation.Bean;
|
|||
* @since 2.0.0
|
||||
*/
|
||||
@AutoConfiguration
|
||||
@ConditionalOnAvailableEndpoint(endpoint = ConfigurationPropertiesReportEndpoint.class)
|
||||
@ConditionalOnAvailableEndpoint(ConfigurationPropertiesReportEndpoint.class)
|
||||
@EnableConfigurationProperties(ConfigurationPropertiesReportEndpointProperties.class)
|
||||
public class ConfigurationPropertiesReportEndpointAutoConfiguration {
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import org.springframework.boot.actuate.autoconfigure.endpoint.expose.EndpointEx
|
|||
import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
|
||||
import org.springframework.boot.actuate.endpoint.annotation.EndpointExtension;
|
||||
import org.springframework.context.annotation.Conditional;
|
||||
import org.springframework.core.annotation.AliasFor;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
/**
|
||||
|
|
@ -111,12 +112,21 @@ import org.springframework.core.env.Environment;
|
|||
@Conditional(OnAvailableEndpointCondition.class)
|
||||
public @interface ConditionalOnAvailableEndpoint {
|
||||
|
||||
/**
|
||||
* Alias for {@link #endpoint()}.
|
||||
* @return the endpoint type to check
|
||||
* @since 3.4.0
|
||||
*/
|
||||
@AliasFor(attribute = "endpoint")
|
||||
Class<?> value() default Void.class;
|
||||
|
||||
/**
|
||||
* The endpoint type that should be checked. Inferred when the return type of the
|
||||
* {@code @Bean} method is either an {@link Endpoint @Endpoint} or an
|
||||
* {@link EndpointExtension @EndpointExtension}.
|
||||
* @return the endpoint type to check
|
||||
*/
|
||||
@AliasFor(attribute = "value")
|
||||
Class<?> endpoint() default Void.class;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ import org.springframework.core.env.Environment;
|
|||
* @since 2.0.0
|
||||
*/
|
||||
@AutoConfiguration
|
||||
@ConditionalOnAvailableEndpoint(endpoint = EnvironmentEndpoint.class)
|
||||
@ConditionalOnAvailableEndpoint(EnvironmentEndpoint.class)
|
||||
@EnableConfigurationProperties(EnvironmentEndpointProperties.class)
|
||||
public class EnvironmentEndpointAutoConfiguration {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -37,7 +37,7 @@ import org.springframework.context.annotation.Bean;
|
|||
*/
|
||||
@AutoConfiguration(after = FlywayAutoConfiguration.class)
|
||||
@ConditionalOnClass(Flyway.class)
|
||||
@ConditionalOnAvailableEndpoint(endpoint = FlywayEndpoint.class)
|
||||
@ConditionalOnAvailableEndpoint(FlywayEndpoint.class)
|
||||
public class FlywayEndpointAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -33,7 +33,7 @@ import org.springframework.context.annotation.Import;
|
|||
* @since 2.0.0
|
||||
*/
|
||||
@AutoConfiguration
|
||||
@ConditionalOnAvailableEndpoint(endpoint = HealthEndpoint.class)
|
||||
@ConditionalOnAvailableEndpoint(HealthEndpoint.class)
|
||||
@EnableConfigurationProperties(HealthEndpointProperties.class)
|
||||
@Import({ HealthEndpointConfiguration.class, ReactiveHealthEndpointConfiguration.class,
|
||||
HealthEndpointWebExtensionConfiguration.class, HealthEndpointReactiveWebExtensionConfiguration.class })
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -32,7 +32,7 @@ import org.springframework.context.annotation.Bean;
|
|||
* @since 2.0.0
|
||||
*/
|
||||
@AutoConfiguration(after = InfoContributorAutoConfiguration.class)
|
||||
@ConditionalOnAvailableEndpoint(endpoint = InfoEndpoint.class)
|
||||
@ConditionalOnAvailableEndpoint(InfoEndpoint.class)
|
||||
public class InfoEndpointAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -39,7 +39,7 @@ import org.springframework.integration.graph.IntegrationGraphServer;
|
|||
@AutoConfiguration(after = IntegrationAutoConfiguration.class)
|
||||
@ConditionalOnClass(IntegrationGraphServer.class)
|
||||
@ConditionalOnBean(IntegrationConfigurationBeanFactoryPostProcessor.class)
|
||||
@ConditionalOnAvailableEndpoint(endpoint = IntegrationGraphEndpoint.class)
|
||||
@ConditionalOnAvailableEndpoint(IntegrationGraphEndpoint.class)
|
||||
public class IntegrationGraphEndpointAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -40,7 +40,7 @@ import org.springframework.context.annotation.Bean;
|
|||
*/
|
||||
@AutoConfiguration(after = LiquibaseAutoConfiguration.class)
|
||||
@ConditionalOnClass(SpringLiquibase.class)
|
||||
@ConditionalOnAvailableEndpoint(endpoint = LiquibaseEndpoint.class)
|
||||
@ConditionalOnAvailableEndpoint(LiquibaseEndpoint.class)
|
||||
public class LiquibaseEndpointAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ import org.springframework.util.StringUtils;
|
|||
* @since 2.0.0
|
||||
*/
|
||||
@AutoConfiguration
|
||||
@ConditionalOnAvailableEndpoint(endpoint = LogFileWebEndpoint.class)
|
||||
@ConditionalOnAvailableEndpoint(LogFileWebEndpoint.class)
|
||||
@EnableConfigurationProperties(LogFileWebEndpointProperties.class)
|
||||
public class LogFileWebEndpointAutoConfiguration {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -40,7 +40,7 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
|
|||
* @since 2.0.0
|
||||
*/
|
||||
@AutoConfiguration
|
||||
@ConditionalOnAvailableEndpoint(endpoint = LoggersEndpoint.class)
|
||||
@ConditionalOnAvailableEndpoint(LoggersEndpoint.class)
|
||||
public class LoggersEndpointAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -30,7 +30,7 @@ import org.springframework.context.annotation.Bean;
|
|||
* @since 2.0.0
|
||||
*/
|
||||
@AutoConfiguration
|
||||
@ConditionalOnAvailableEndpoint(endpoint = HeapDumpWebEndpoint.class)
|
||||
@ConditionalOnAvailableEndpoint(HeapDumpWebEndpoint.class)
|
||||
public class HeapDumpWebEndpointAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -30,7 +30,7 @@ import org.springframework.context.annotation.Bean;
|
|||
* @since 2.0.0
|
||||
*/
|
||||
@AutoConfiguration
|
||||
@ConditionalOnAvailableEndpoint(endpoint = ThreadDumpEndpoint.class)
|
||||
@ConditionalOnAvailableEndpoint(ThreadDumpEndpoint.class)
|
||||
public class ThreadDumpEndpointAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -36,7 +36,7 @@ import org.springframework.context.annotation.Bean;
|
|||
*/
|
||||
@AutoConfiguration(after = { MetricsAutoConfiguration.class, CompositeMeterRegistryAutoConfiguration.class })
|
||||
@ConditionalOnClass(Timed.class)
|
||||
@ConditionalOnAvailableEndpoint(endpoint = MetricsEndpoint.class)
|
||||
@ConditionalOnAvailableEndpoint(MetricsEndpoint.class)
|
||||
public class MetricsEndpointAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ public class PrometheusMetricsExportAutoConfiguration {
|
|||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnAvailableEndpoint(endpoint = PrometheusScrapeEndpoint.class)
|
||||
@ConditionalOnAvailableEndpoint(PrometheusScrapeEndpoint.class)
|
||||
static class PrometheusScrapeEndpointConfiguration {
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ public class PrometheusSimpleclientMetricsExportAutoConfiguration {
|
|||
|
||||
@SuppressWarnings("removal")
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnAvailableEndpoint(endpoint = PrometheusSimpleclientScrapeEndpoint.class)
|
||||
@ConditionalOnAvailableEndpoint(PrometheusSimpleclientScrapeEndpoint.class)
|
||||
static class PrometheusScrapeEndpointConfiguration {
|
||||
|
||||
@Bean
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ import org.springframework.context.annotation.Bean;
|
|||
*/
|
||||
@AutoConfiguration(after = QuartzAutoConfiguration.class)
|
||||
@ConditionalOnClass(Scheduler.class)
|
||||
@ConditionalOnAvailableEndpoint(endpoint = QuartzEndpoint.class)
|
||||
@ConditionalOnAvailableEndpoint(QuartzEndpoint.class)
|
||||
@EnableConfigurationProperties(QuartzEndpointProperties.class)
|
||||
public class QuartzEndpointAutoConfiguration {
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ import org.springframework.core.io.ResourceLoader;
|
|||
* @since 3.3.0
|
||||
*/
|
||||
@AutoConfiguration
|
||||
@ConditionalOnAvailableEndpoint(endpoint = SbomEndpoint.class)
|
||||
@ConditionalOnAvailableEndpoint(SbomEndpoint.class)
|
||||
@EnableConfigurationProperties(SbomProperties.class)
|
||||
public class SbomEndpointAutoConfiguration {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -32,7 +32,7 @@ import org.springframework.scheduling.config.ScheduledTaskHolder;
|
|||
* @since 2.0.0
|
||||
*/
|
||||
@AutoConfiguration
|
||||
@ConditionalOnAvailableEndpoint(endpoint = ScheduledTasksEndpoint.class)
|
||||
@ConditionalOnAvailableEndpoint(ScheduledTasksEndpoint.class)
|
||||
public class ScheduledTasksEndpointAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ import org.springframework.session.SessionRepository;
|
|||
*/
|
||||
@AutoConfiguration(after = SessionAutoConfiguration.class)
|
||||
@ConditionalOnClass(Session.class)
|
||||
@ConditionalOnAvailableEndpoint(endpoint = SessionsEndpoint.class)
|
||||
@ConditionalOnAvailableEndpoint(SessionsEndpoint.class)
|
||||
public class SessionsEndpointAutoConfiguration {
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -38,7 +38,7 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
|
|||
* @since 2.4.0
|
||||
*/
|
||||
@AutoConfiguration
|
||||
@ConditionalOnAvailableEndpoint(endpoint = StartupEndpoint.class)
|
||||
@ConditionalOnAvailableEndpoint(StartupEndpoint.class)
|
||||
@Conditional(StartupEndpointAutoConfiguration.ApplicationStartupCondition.class)
|
||||
public class StartupEndpointAutoConfiguration {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -33,7 +33,7 @@ import org.springframework.context.annotation.Bean;
|
|||
* @since 3.0.0
|
||||
*/
|
||||
@AutoConfiguration(after = HttpExchangesAutoConfiguration.class)
|
||||
@ConditionalOnAvailableEndpoint(endpoint = HttpExchangesEndpoint.class)
|
||||
@ConditionalOnAvailableEndpoint(HttpExchangesEndpoint.class)
|
||||
public class HttpExchangesEndpointAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -43,7 +43,7 @@ import org.springframework.web.servlet.DispatcherServlet;
|
|||
* @since 2.0.0
|
||||
*/
|
||||
@AutoConfiguration
|
||||
@ConditionalOnAvailableEndpoint(endpoint = MappingsEndpoint.class)
|
||||
@ConditionalOnAvailableEndpoint(MappingsEndpoint.class)
|
||||
public class MappingsEndpointAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
|
|
|
|||
|
|
@ -335,7 +335,7 @@ class ConditionalOnAvailableEndpointTests {
|
|||
static class ComponentEnabledIfEndpointIsExposedConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnAvailableEndpoint(endpoint = SpringEndpoint.class)
|
||||
@ConditionalOnAvailableEndpoint(SpringEndpoint.class)
|
||||
String springComponent() {
|
||||
return "springComponent";
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue