|
16 | 16 |
|
17 | 17 | package org.springframework.boot.actuate.autoconfigure.neo4j;
|
18 | 18 |
|
19 |
| -import org.springframework.boot.actuate.autoconfigure.health.CompositeHealthContributorConfiguration; |
20 |
| -import org.springframework.boot.actuate.autoconfigure.health.CompositeReactiveHealthContributorConfiguration; |
| 19 | +import org.neo4j.driver.Driver; |
| 20 | + |
21 | 21 | import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator;
|
22 |
| -import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration; |
23 |
| -import org.springframework.boot.actuate.health.Health; |
24 |
| -import org.springframework.boot.actuate.health.HealthContributor; |
25 |
| -import org.springframework.boot.actuate.health.ReactiveHealthContributor; |
| 22 | +import org.springframework.boot.actuate.autoconfigure.neo4j.Neo4jHealthContributorConfigurations.Neo4jConfiguration; |
| 23 | +import org.springframework.boot.actuate.autoconfigure.neo4j.Neo4jHealthContributorConfigurations.Neo4jReactiveConfiguration; |
26 | 24 | import org.springframework.boot.actuate.neo4j.Neo4jHealthIndicator;
|
27 | 25 | import org.springframework.boot.actuate.neo4j.Neo4jReactiveHealthIndicator;
|
28 | 26 | import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
29 |
| -import org.springframework.boot.autoconfigure.AutoConfigureBefore; |
30 | 27 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
31 | 28 | import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
32 | 29 | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
33 |
| -import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; |
34 |
| -import org.springframework.boot.autoconfigure.data.neo4j.Neo4jDataAutoConfiguration; |
35 |
| -import org.springframework.boot.autoconfigure.neo4j.Neo4jDriverAutoConfiguration; |
36 |
| -import org.springframework.context.annotation.Bean; |
| 30 | +import org.springframework.boot.autoconfigure.neo4j.Neo4jAutoConfiguration; |
37 | 31 | import org.springframework.context.annotation.Configuration;
|
38 |
| -import org.springframework.core.annotation.Order; |
39 |
| -import reactor.core.publisher.Flux; |
40 |
| - |
41 |
| -import java.util.Map; |
42 |
| - |
43 |
| -import org.neo4j.driver.Driver; |
| 32 | +import org.springframework.context.annotation.Import; |
44 | 33 |
|
45 | 34 | /**
|
46 |
| - * {@link EnableAutoConfiguration Auto-configuration} for {@link Neo4jHealthIndicator}. |
47 |
| - * The auto-configuration here is responsible for both imperative and reactive health |
48 |
| - * checks. The reactive health check has precedence over the imperative one. |
| 35 | + * {@link EnableAutoConfiguration Auto-configuration} for |
| 36 | + * {@link Neo4jReactiveHealthIndicator} and {@link Neo4jHealthIndicator}. |
49 | 37 | *
|
50 | 38 | * @author Eric Spiegelberg
|
51 | 39 | * @author Stephane Nicoll
|
52 | 40 | * @author Michael J. Simons
|
53 | 41 | * @since 2.0.0
|
54 | 42 | */
|
55 | 43 | @Configuration(proxyBeanMethods = false)
|
56 |
| -@ConditionalOnClass({ Driver.class, Health.class }) |
| 44 | +@ConditionalOnClass(Driver.class) |
57 | 45 | @ConditionalOnBean(Driver.class)
|
58 | 46 | @ConditionalOnEnabledHealthIndicator("neo4j")
|
59 |
| -@AutoConfigureBefore(HealthContributorAutoConfiguration.class) |
60 |
| -@AutoConfigureAfter({ Neo4jDriverAutoConfiguration.class, Neo4jDataAutoConfiguration.class }) |
| 47 | +@AutoConfigureAfter(Neo4jAutoConfiguration.class) |
| 48 | +@Import({ Neo4jReactiveConfiguration.class, Neo4jConfiguration.class }) |
61 | 49 | public class Neo4jHealthContributorAutoConfiguration {
|
62 | 50 |
|
63 |
| - @Configuration(proxyBeanMethods = false) |
64 |
| - @Order(-20) |
65 |
| - static class Neo4jHealthIndicatorConfiguration |
66 |
| - extends CompositeHealthContributorConfiguration<Neo4jHealthIndicator, Driver> { |
67 |
| - |
68 |
| - @Bean |
69 |
| - // If Neo4jReactiveHealthIndicatorConfiguration kicked in, don't add the |
70 |
| - // imperative version as well |
71 |
| - @ConditionalOnMissingBean(name = "neo4jHealthContributor") |
72 |
| - public HealthContributor neo4jHealthContributor(Map<String, Driver> drivers) { |
73 |
| - return createContributor(drivers); |
74 |
| - } |
75 |
| - |
76 |
| - } |
77 |
| - |
78 |
| - @Configuration(proxyBeanMethods = false) |
79 |
| - @ConditionalOnClass({ Flux.class }) |
80 |
| - @Order(-30) |
81 |
| - static class Neo4jReactiveHealthIndicatorConfiguration |
82 |
| - extends CompositeReactiveHealthContributorConfiguration<Neo4jReactiveHealthIndicator, Driver> { |
83 |
| - |
84 |
| - @Bean |
85 |
| - @ConditionalOnMissingBean(name = "neo4jHealthContributor") |
86 |
| - public ReactiveHealthContributor neo4jHealthContributor(Map<String, Driver> drivers) { |
87 |
| - return createComposite(drivers); |
88 |
| - } |
89 |
| - |
90 |
| - } |
91 |
| - |
92 | 51 | }
|
0 commit comments