Commit b8f11e79 by Spencer Gibb

Atlas no longer requires a RestTemplate bean.

fixes gh-881
parent 4f31596e
......@@ -17,6 +17,7 @@ import java.util.Collection;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.actuate.metrics.export.Exporter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
......@@ -42,6 +43,10 @@ public class AtlasConfiguration {
@Autowired(required = false)
private Collection<AtlasTagProvider> tagProviders;
@Autowired(required = false)
@Qualifier("atlasRestTemplate")
private RestTemplate restTemplate = new RestTemplate();
@Bean
public AtlasMetricObserverConfigBean atlasObserverConfig() {
return new AtlasMetricObserverConfigBean();
......@@ -49,7 +54,7 @@ public class AtlasConfiguration {
@Bean
@ConditionalOnMissingBean
public AtlasMetricObserver atlasObserver(AtlasMetricObserverConfigBean atlasObserverConfig, RestTemplate restTemplate) {
public AtlasMetricObserver atlasObserver(AtlasMetricObserverConfigBean atlasObserverConfig) {
BasicTagList tags = (BasicTagList) BasicTagList.EMPTY;
if (tagProviders != null) {
for (AtlasTagProvider tagProvider : tagProviders) {
......
......@@ -18,9 +18,9 @@ import java.util.Properties;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
......@@ -41,10 +41,10 @@ import com.netflix.servo.monitor.DynamicCounter;
@RunWith(SpringJUnit4ClassRunner.class)
public class AtlasExporterTests {
@Autowired
RestTemplate restTemplate;
private RestTemplate restTemplate;
@Autowired
AtlasExporter atlasExporter;
private AtlasExporter atlasExporter;
@Test
public void exportMetricsAtPeriodicIntervals() {
......@@ -68,7 +68,7 @@ public class AtlasExporterTests {
@EnableAtlas
class AtlasExporterConfiguration {
@LoadBalanced
@Qualifier("atlasRestTemplate")
@Bean
public RestTemplate restTemplate() {
return new RestTemplate();
......
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