1. 在build.gradle中加入以下内容
apply plugin: 'io.spring.dependency-management'
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:Dalston.RELEASE"
}
}
compile("org.springframework.cloud:spring-cloud-starter-zipkin")
2.在启动类里加入以下内容
@Autowired
private RestTemplate restTemplate;
@Bean
public RestTemplate getRestTemplate(){
return new RestTemplate();
}
@Bean
public AlwaysSampler defaultSampler(){
return new AlwaysSampler();
}
3. 暂时需要remove swagger相关的配置,否则zipkin不工作