|
16 | 16 |
|
17 | 17 | package org.springframework.boot.actuate.autoconfigure.couchbase; |
18 | 18 |
|
19 | | -import java.util.Map; |
20 | | - |
21 | 19 | import com.couchbase.client.java.Bucket; |
22 | 20 |
|
23 | | -import org.springframework.boot.actuate.autoconfigure.health.CompositeHealthIndicatorConfiguration; |
24 | 21 | import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator; |
25 | 22 | import org.springframework.boot.actuate.autoconfigure.health.HealthIndicatorAutoConfiguration; |
26 | 23 | import org.springframework.boot.actuate.couchbase.CouchbaseHealthIndicator; |
27 | | -import org.springframework.boot.actuate.health.HealthIndicator; |
28 | 24 | import org.springframework.boot.autoconfigure.AutoConfigureAfter; |
29 | 25 | import org.springframework.boot.autoconfigure.AutoConfigureBefore; |
30 | 26 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; |
31 | | -import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; |
32 | 27 | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; |
33 | | -import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; |
| 28 | +import org.springframework.boot.autoconfigure.couchbase.CouchbaseAutoConfiguration; |
34 | 29 | import org.springframework.boot.autoconfigure.data.couchbase.CouchbaseDataAutoConfiguration; |
35 | | -import org.springframework.boot.context.properties.EnableConfigurationProperties; |
36 | | -import org.springframework.context.annotation.Bean; |
| 30 | +import org.springframework.boot.autoconfigure.data.couchbase.CouchbaseReactiveDataAutoConfiguration; |
37 | 31 | import org.springframework.context.annotation.Configuration; |
38 | | -import org.springframework.data.couchbase.core.CouchbaseOperations; |
| 32 | +import org.springframework.context.annotation.Import; |
39 | 33 |
|
40 | 34 | /** |
41 | 35 | * {@link EnableAutoConfiguration Auto-configuration} for |
|
46 | 40 | * @since 2.0.0 |
47 | 41 | */ |
48 | 42 | @Configuration |
49 | | -@ConditionalOnClass({ CouchbaseOperations.class, Bucket.class }) |
50 | | -@ConditionalOnBean(CouchbaseOperations.class) |
| 43 | +@ConditionalOnClass(Bucket.class) |
51 | 44 | @ConditionalOnEnabledHealthIndicator("couchbase") |
52 | 45 | @AutoConfigureBefore(HealthIndicatorAutoConfiguration.class) |
53 | | -@AutoConfigureAfter(CouchbaseDataAutoConfiguration.class) |
54 | | -@EnableConfigurationProperties(CouchbaseHealthIndicatorProperties.class) |
55 | | -public class CouchbaseHealthIndicatorAutoConfiguration extends |
56 | | - CompositeHealthIndicatorConfiguration<CouchbaseHealthIndicator, CouchbaseOperations> { |
57 | | - |
58 | | - private final Map<String, CouchbaseOperations> couchbaseOperations; |
59 | | - |
60 | | - private final CouchbaseHealthIndicatorProperties properties; |
61 | | - |
62 | | - public CouchbaseHealthIndicatorAutoConfiguration( |
63 | | - Map<String, CouchbaseOperations> couchbaseOperations, |
64 | | - CouchbaseHealthIndicatorProperties properties) { |
65 | | - this.couchbaseOperations = couchbaseOperations; |
66 | | - this.properties = properties; |
67 | | - } |
68 | | - |
69 | | - @Bean |
70 | | - @ConditionalOnMissingBean(name = "couchbaseHealthIndicator") |
71 | | - public HealthIndicator couchbaseHealthIndicator() { |
72 | | - return createHealthIndicator(this.couchbaseOperations); |
73 | | - } |
74 | | - |
75 | | - @Override |
76 | | - protected CouchbaseHealthIndicator createHealthIndicator( |
77 | | - CouchbaseOperations couchbaseOperations) { |
78 | | - return new CouchbaseHealthIndicator(couchbaseOperations, |
79 | | - this.properties.getTimeout()); |
80 | | - } |
| 46 | +@AutoConfigureAfter({ CouchbaseAutoConfiguration.class, |
| 47 | + CouchbaseDataAutoConfiguration.class, |
| 48 | + CouchbaseReactiveDataAutoConfiguration.class }) |
| 49 | +@Import({ CouchbaseHealthIndicatorConfiguration.class, |
| 50 | + CouchbaseReactiveHealthIndicatorConfiguration.class }) |
| 51 | +public class CouchbaseHealthIndicatorAutoConfiguration { |
81 | 52 |
|
82 | 53 | } |
0 commit comments