Browse Source

Extract common config utility into a separate package

pull/15/head
Dave Syer 10 years ago
parent
commit
222b33af29
  1. 28
      src/main/java/org/springframework/cloud/client/CommonsClientAutoConfiguration.java
  2. 2
      src/main/java/org/springframework/cloud/client/ServiceInstance.java
  3. 2
      src/main/java/org/springframework/cloud/client/circuitbreaker/EnableCircuitBreakerImportSelector.java
  4. 2
      src/main/java/org/springframework/cloud/client/discovery/EnableDiscoveryClientImportSelector.java
  5. 2
      src/main/java/org/springframework/cloud/util/SingleImplementationImportSelector.java
  6. 2
      src/main/resources/META-INF/spring.factories
  7. 3
      src/test/java/org/springframework/cloud/util/SingleImplementationImportSelectorTests.java

28
src/main/java/org/springframework/cloud/client/CommonsClientAutoConfiguration.java

@ -39,25 +39,21 @@ import org.springframework.core.annotation.Order; @@ -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);
}
}

2
src/main/java/org/springframework/cloud/client/ServiceInstance.java

@ -21,8 +21,6 @@ package org.springframework.cloud.client; @@ -21,8 +21,6 @@ package org.springframework.cloud.client;
*/
public interface ServiceInstance {
// TODO: name? Server? HostAndPort? Instance?
public String getServiceId();
public String getHost();

2
src/main/java/org/springframework/cloud/client/circuitbreaker/EnableCircuitBreakerImportSelector.java

@ -17,7 +17,7 @@ @@ -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;

2
src/main/java/org/springframework/cloud/client/discovery/EnableDiscoveryClientImportSelector.java

@ -17,7 +17,7 @@ @@ -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;

2
src/main/java/org/springframework/cloud/client/SingleImplementationImportSelector.java → src/main/java/org/springframework/cloud/util/SingleImplementationImportSelector.java

@ -14,7 +14,7 @@ @@ -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;

2
src/main/resources/META-INF/spring.factories

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
# Bootstrap Configuration
# AutoConfiguration
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
org.springframework.cloud.client.CommonsClientAutoConfiguration,\
org.springframework.cloud.client.discovery.noop.NoopDiscoveryClientAutoConfiguration

3
src/test/java/org/springframework/cloud/client/SingleImplementationImportSelectorTests.java → src/test/java/org/springframework/cloud/util/SingleImplementationImportSelectorTests.java

@ -14,9 +14,10 @@ @@ -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;
Loading…
Cancel
Save