Make RabbitHealthIndicator conditional
- When the spring-boot actuator is not in the classpath, the RabbitServiceAutoConfiguration should exclude RabbitHealthIndicator Resolves #55
This commit is contained in:
committed by
Soby Chacko
parent
f8a67441b8
commit
88c00e0b25
@@ -44,17 +44,13 @@ import org.springframework.context.annotation.Profile;
|
||||
* @author David Turanski
|
||||
* @author Eric Bottard
|
||||
* @author Marius Bogoevici
|
||||
* @author Ilayaperumal Gopinathan
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnMissingBean(Binder.class)
|
||||
@Import(RabbitMessageChannelBinderConfiguration.class)
|
||||
@Import({RabbitMessageChannelBinderConfiguration.class, RabbitServiceAutoConfiguration.RabbitHealthIndicatorConfiguration.class})
|
||||
public class RabbitServiceAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
public HealthIndicator binderHealthIndicator(RabbitTemplate rabbitTemplate) {
|
||||
return new RabbitHealthIndicator(rabbitTemplate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configuration to be used when the cloud profile is set.
|
||||
*/
|
||||
@@ -134,4 +130,14 @@ public class RabbitServiceAutoConfiguration {
|
||||
@Import(RabbitAutoConfiguration.class)
|
||||
protected static class NoCloudProfile {
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnClass(name = "org.springframework.boot.actuate.health.HealthIndicator")
|
||||
public static class RabbitHealthIndicatorConfiguration {
|
||||
|
||||
@Bean
|
||||
public HealthIndicator binderHealthIndicator(RabbitTemplate rabbitTemplate) {
|
||||
return new RabbitHealthIndicator(rabbitTemplate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user