基于Finchley.SR2的springcloud系列代码(Zipkin进行服务跟踪)(九)

备注:源代码已经全部上传到github,有错误地方请指正,谢谢!地址:https://github.com/hcmony/springcloud 

1,pom.xml 注意这里的父pom是直接引用springboot的1.5.6版本



	4.0.0

	
		org.springframework.boot
		spring-boot-starter-parent
		1.5.6.RELEASE
	

	com.hcmony
	sleuth
	jar

	
		UTF-8
		UTF-8
		1.8
	

	
		
			com.alibaba
			fastjson
			1.2.48
		
		
			io.zipkin.java
			zipkin-server
			1.28.0
		
		
			io.zipkin.java
			zipkin-autoconfigure-ui
			1.28.0
		
		
			org.springframework.cloud
			spring-cloud-starter-eureka
			1.3.6.RELEASE
		
	

	
		
			
				org.springframework.boot
				spring-boot-maven-plugin
			
		
	



2,配置文件(application.properties)

server.port=9411
spring.application.name=sleuth
eureka.client.service-url.defaultZone= http://localhsot:8888/eureka/
eureka.instance.preferIpAddress=true
eureka.instance.instance-id=${spring.cloud.client.ipAddress}:${server.port}

spring.sleuth.enabled=false

#��·��ַ
spring.zipkin.base-url=http://localhsot:9411

#��ص�ַ
spring.boot.admin.client.url=http://localhsot:8070
spring.boot.admin.client.username=root
spring.boot.admin.client.password=root
#��¶actuator�����ж˵�
management.endpoints.web.exposure.include=*
#health endpoint�Ƿ������ʾȫ��ϸ�ڡ�Ĭ�������, /actuator/health �ǹ����ģ����Ҳ���ʾϸ��
management.endpoint.health.show-details=always

3,java代码

package com.hcmony;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import zipkin.server.EnableZipkinServer;

/**
 * 也可直接去下载使用,不用创建服务项目
 * 下载地址:https://dl.bintray.com/openzipkin/maven/io/zipkin/java/zipkin-server/
 * 也可访问链接: https://pan.baidu.com/s/1eRSy1eHv3XahlAHHbA1kyA 提取码: pkv6 复制这段内容后打开百度网盘手机App,操作更方便哦
 */
@SpringBootApplication
@EnableEurekaClient
@EnableZipkinServer
public class SleuthApplication {

	public static void main(String[] args) {
		SpringApplication.run(SleuthApplication.class, args);
	}
}

 

你可能感兴趣的:(java基础,SpringCloud)