add support for HasFeatures
This commit is contained in:
@@ -41,6 +41,7 @@ import org.springframework.boot.autoconfigure.condition.SearchStrategy;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.cloud.autoconfigure.RefreshAutoConfiguration;
|
||||
import org.springframework.cloud.client.CommonsClientAutoConfiguration;
|
||||
import org.springframework.cloud.client.actuator.HasFeatures;
|
||||
import org.springframework.cloud.client.discovery.DiscoveryClient;
|
||||
import org.springframework.cloud.client.discovery.noop.NoopDiscoveryClientAutoConfiguration;
|
||||
import org.springframework.cloud.context.scope.refresh.RefreshScope;
|
||||
@@ -74,6 +75,11 @@ public class EurekaClientAutoConfiguration {
|
||||
@Autowired
|
||||
ConfigurableEnvironment env;
|
||||
|
||||
@Bean
|
||||
public HasFeatures eurekaFeature() {
|
||||
return HasFeatures.namedFeature("Eureka Client", EurekaClient.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(value = EurekaClientConfig.class, search = SearchStrategy.CURRENT)
|
||||
public EurekaClientConfigBean eurekaClientConfigBean() {
|
||||
|
||||
@@ -18,7 +18,9 @@ package org.springframework.cloud.netflix.feign;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.cloud.client.actuator.HasFeatures;
|
||||
import org.springframework.cloud.netflix.archaius.ArchaiusAutoConfiguration;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
@@ -34,4 +36,8 @@ import feign.Feign;
|
||||
@Import(FeignClientsConfiguration.class)
|
||||
public class FeignAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
public HasFeatures feignFeature() {
|
||||
return HasFeatures.namedFeature("Feign", Feign.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,8 @@ import org.springframework.boot.actuate.metrics.GaugeService;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
|
||||
import org.springframework.cloud.client.actuator.HasFeatures;
|
||||
import org.springframework.cloud.client.actuator.NamedFeature;
|
||||
import org.springframework.context.SmartLifecycle;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -61,6 +63,11 @@ public class HystrixCircuitBreakerConfiguration {
|
||||
return new HystrixShutdownHook();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public HasFeatures hystrixFeature() {
|
||||
return HasFeatures.namedFeatures(new NamedFeature("Hystrix", HystrixCommandAspect.class));
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnProperty(value = "hystrix.stream.endpoint.enabled", matchIfMissing = true)
|
||||
@ConditionalOnWebApplication
|
||||
@@ -72,6 +79,10 @@ public class HystrixCircuitBreakerConfiguration {
|
||||
return new HystrixStreamEndpoint();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public HasFeatures hystrixFeature() {
|
||||
return HasFeatures.namedFeature("Hystrix Stream Servlet", HystrixStreamEndpoint.class);
|
||||
}
|
||||
}
|
||||
|
||||
@Configuration
|
||||
|
||||
@@ -19,11 +19,13 @@ package org.springframework.cloud.netflix.ribbon;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.netflix.ribbon.Ribbon;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.cloud.client.actuator.HasFeatures;
|
||||
import org.springframework.cloud.client.loadbalancer.LoadBalancerAutoConfiguration;
|
||||
import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;
|
||||
import org.springframework.cloud.client.loadbalancer.RestTemplateCustomizer;
|
||||
@@ -51,6 +53,11 @@ public class RibbonAutoConfiguration {
|
||||
@Autowired(required = false)
|
||||
private List<RibbonClientSpecification> configurations = new ArrayList<>();
|
||||
|
||||
@Bean
|
||||
public HasFeatures ribbonFeature() {
|
||||
return HasFeatures.namedFeature("Ribbon", Ribbon.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SpringClientFactory springClientFactory() {
|
||||
SpringClientFactory factory = new SpringClientFactory();
|
||||
|
||||
@@ -20,6 +20,7 @@ import java.util.List;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
|
||||
import org.springframework.cloud.client.actuator.HasFeatures;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.method.support.AsyncHandlerMethodReturnValueHandler;
|
||||
@@ -53,5 +54,10 @@ public class RxJavaAutoConfiguration {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Bean
|
||||
public HasFeatures rxFeature() {
|
||||
return HasFeatures.namedFeature("MVC Observable", Observable.class);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.web.ErrorController;
|
||||
import org.springframework.boot.context.embedded.ServletRegistrationBean;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.cloud.client.actuator.HasFeatures;
|
||||
import org.springframework.cloud.context.scope.refresh.RefreshScopeRefreshedEvent;
|
||||
import org.springframework.cloud.netflix.zuul.filters.RouteLocator;
|
||||
import org.springframework.cloud.netflix.zuul.filters.SimpleRouteLocator;
|
||||
@@ -58,6 +59,11 @@ public class ZuulConfiguration {
|
||||
@Autowired(required = false)
|
||||
private ErrorController errorController;
|
||||
|
||||
@Bean
|
||||
public HasFeatures zuulFeature() {
|
||||
return HasFeatures.namedFeature("Zuul (Simple)", ZuulConfiguration.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public RouteLocator routeLocator() {
|
||||
return new SimpleRouteLocator(this.zuulProperties);
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.springframework.boot.actuate.trace.TraceRepository;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.web.ServerProperties;
|
||||
import org.springframework.cloud.client.actuator.HasFeatures;
|
||||
import org.springframework.cloud.client.discovery.DiscoveryClient;
|
||||
import org.springframework.cloud.client.discovery.event.HeartbeatEvent;
|
||||
import org.springframework.cloud.client.discovery.event.HeartbeatMonitor;
|
||||
@@ -65,6 +66,11 @@ public class ZuulProxyConfiguration extends ZuulConfiguration {
|
||||
@Autowired
|
||||
private ServerProperties server;
|
||||
|
||||
@Override
|
||||
public HasFeatures zuulFeature() {
|
||||
return HasFeatures.namedFeature("Zuul (Discovery)", ZuulProxyConfiguration.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@Override
|
||||
public ProxyRouteLocator routeLocator() {
|
||||
|
||||
@@ -32,6 +32,7 @@ import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.embedded.FilterRegistrationBean;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.cloud.client.actuator.HasFeatures;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.netflix.eureka.EurekaServerConfigBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -67,6 +68,11 @@ public class EurekaServerConfiguration extends WebMvcConfigurerAdapter {
|
||||
@Autowired
|
||||
private ApplicationInfoManager applicationInfoManager;
|
||||
|
||||
@Bean
|
||||
public HasFeatures eurekaServerFeature() {
|
||||
return HasFeatures.namedFeature("Eureka Server", EurekaServerConfiguration.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(prefix = "eureka.dashboard", name = "enabled", matchIfMissing = true)
|
||||
public EurekaController eurekaController() {
|
||||
|
||||
@@ -42,6 +42,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.freemarker.FreeMarkerAutoConfiguration;
|
||||
import org.springframework.boot.context.embedded.ServletRegistrationBean;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.cloud.client.actuator.HasFeatures;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
@@ -64,6 +65,11 @@ public class HystrixDashboardConfiguration {
|
||||
@Autowired
|
||||
private HystrixDashboardProperties dashboardProperties;
|
||||
|
||||
@Bean
|
||||
public HasFeatures hystrixDashboardFeature() {
|
||||
return HasFeatures.namedFeature("Hystrix Dashboard", HystrixDashboardConfiguration.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides Spring Boot's {@link FreeMarkerAutoConfiguration} to prefer using a
|
||||
* {@link SpringTemplateLoader} instead of the file system. This corrects an issue
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.cloud.client.actuator.HasFeatures;
|
||||
import org.springframework.cloud.stream.annotation.EnableBinding;
|
||||
import org.springframework.cloud.stream.config.BindingProperties;
|
||||
import org.springframework.cloud.stream.config.ChannelBindingServiceProperties;
|
||||
@@ -61,6 +62,11 @@ public class HystrixStreamAutoConfiguration {
|
||||
@Autowired
|
||||
private HystrixStreamProperties properties;
|
||||
|
||||
@Bean
|
||||
public HasFeatures hystrixStreamQueueFeature() {
|
||||
return HasFeatures.namedFeature("Hystrix Stream (Queue)", HystrixStreamAutoConfiguration.class);
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
BindingProperties outputBinding = this.bindings.getBindings().get(HystrixStreamClient.OUTPUT);
|
||||
|
||||
@@ -21,6 +21,7 @@ import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.cloud.client.actuator.HasFeatures;
|
||||
import org.springframework.cloud.netflix.eureka.EurekaInstanceConfigBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -36,6 +37,11 @@ import com.netflix.discovery.EurekaClientConfig;
|
||||
@ConditionalOnProperty(value = "spring.cloud.netflix.sidecar.enabled", matchIfMissing = true)
|
||||
public class SidecarConfiguration {
|
||||
|
||||
@Bean
|
||||
public HasFeatures Feature() {
|
||||
return HasFeatures.namedFeature("Netflix Sidecar", SidecarConfiguration.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SidecarProperties sidecarProperties() {
|
||||
return new SidecarProperties();
|
||||
|
||||
@@ -53,6 +53,11 @@
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-commons</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.integration</groupId>
|
||||
<artifactId>spring-integration-core</artifactId>
|
||||
|
||||
@@ -30,6 +30,7 @@ import lombok.extern.apachecommons.CommonsLog;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.cloud.client.actuator.HasFeatures;
|
||||
import org.springframework.context.SmartLifecycle;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -59,6 +60,11 @@ public class TurbineStreamConfiguration implements SmartLifecycle {
|
||||
|
||||
private int turbinePort;
|
||||
|
||||
@Bean
|
||||
public HasFeatures Feature() {
|
||||
return HasFeatures.namedFeature("Turbine (Stream)", TurbineStreamProperties.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public PublishSubject<Map<String, Object>> hystrixSubject() {
|
||||
return PublishSubject.create();
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.netflix.discovery.EurekaClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.context.embedded.ServletRegistrationBean;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.cloud.client.actuator.HasFeatures;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.context.SmartLifecycle;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -42,6 +43,11 @@ public class TurbineConfiguration implements SmartLifecycle, Ordered {
|
||||
@Autowired
|
||||
private EurekaClient eurekaClient;
|
||||
|
||||
@Bean
|
||||
public HasFeatures Feature() {
|
||||
return HasFeatures.namedFeature("Turbine (HTTP)", TurbineConfiguration.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ServletRegistrationBean turbineStreamServlet() {
|
||||
return new ServletRegistrationBean(new TurbineStreamServlet(), "/turbine.stream");
|
||||
|
||||
Reference in New Issue
Block a user