Extract common config utility into a separate package
This commit is contained in:
@@ -39,25 +39,21 @@ import org.springframework.core.annotation.Order;
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnClass(HealthIndicator.class)
|
||||
@ConditionalOnBean(DiscoveryClient.class)
|
||||
@ConditionalOnProperty(value = "spring.cloud.discovery.enabled", matchIfMissing = true)
|
||||
@Order(0)
|
||||
public class CommonsClientAutoConfiguration {
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnBean(DiscoveryClient.class)
|
||||
@ConditionalOnProperty(value = "spring.cloud.discovery.enabled", matchIfMissing = true)
|
||||
protected static class HealthConfiguration {
|
||||
|
||||
@Bean
|
||||
public DiscoveryClientHealthIndicator instancesHealthIndicator(
|
||||
DiscoveryClient discoveryClient) {
|
||||
return new DiscoveryClientHealthIndicator(discoveryClient);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public DiscoveryCompositeHealthIndicator discoveryHealthIndicator(
|
||||
HealthAggregator aggregator, List<DiscoveryHealthIndicator> indicators) {
|
||||
return new DiscoveryCompositeHealthIndicator(aggregator, indicators);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public DiscoveryClientHealthIndicator instancesHealthIndicator(
|
||||
DiscoveryClient discoveryClient) {
|
||||
return new DiscoveryClientHealthIndicator(discoveryClient);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public DiscoveryCompositeHealthIndicator discoveryHealthIndicator(
|
||||
HealthAggregator aggregator, List<DiscoveryHealthIndicator> indicators) {
|
||||
return new DiscoveryCompositeHealthIndicator(aggregator, indicators);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,8 +21,6 @@ package org.springframework.cloud.client;
|
||||
*/
|
||||
public interface ServiceInstance {
|
||||
|
||||
// TODO: name? Server? HostAndPort? Instance?
|
||||
|
||||
public String getServiceId();
|
||||
|
||||
public String getHost();
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
package org.springframework.cloud.client.circuitbreaker;
|
||||
|
||||
import org.springframework.boot.bind.RelaxedPropertyResolver;
|
||||
import org.springframework.cloud.client.SingleImplementationImportSelector;
|
||||
import org.springframework.cloud.util.SingleImplementationImportSelector;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.annotation.Order;
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
package org.springframework.cloud.client.discovery;
|
||||
|
||||
import org.springframework.boot.bind.RelaxedPropertyResolver;
|
||||
import org.springframework.cloud.client.SingleImplementationImportSelector;
|
||||
import org.springframework.cloud.util.SingleImplementationImportSelector;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.annotation.Order;
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.client;
|
||||
package org.springframework.cloud.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@@ -1,4 +1,4 @@
|
||||
# Bootstrap Configuration
|
||||
# AutoConfiguration
|
||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
||||
org.springframework.cloud.client.CommonsClientAutoConfiguration,\
|
||||
org.springframework.cloud.client.discovery.noop.NoopDiscoveryClientAutoConfiguration
|
||||
|
||||
@@ -14,9 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.client;
|
||||
package org.springframework.cloud.util;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.cloud.util.SingleImplementationImportSelector;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
Reference in New Issue
Block a user