Commit 7cf0fa48 by Spencer Gibb

add support for HasFeatures

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