spring-boot2.1.9.RELEASE+zipkin2.12.9搭建zipkin-server

spring-boot2.1.9.RELEASE+zipkin2.12.9搭建zipkin-server

    spring-boot当前最新版本2.2.1.RELEASE
    zipkin当前最新版本2.12.9

spring-boot2.0后官方不推荐自定义zipkin-server 并提供了可执行jar 下载地址 选择exec.jar结尾的jar下载即可 java -jar zipkin-server-2.12.9-exec.jar

但是依然希望可在cloud项目中管理 经过一些努力 本文可在spring-boot2.1.9.RELEAS+zipkin2.12.9下运行 代码如下

pom.xml


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


com.example
zipkin-server
1.0
zipkin-server
this-zipkin-server


    UTF-8
    UTF-8
    1.8
    Hoxton.M3
    2.12.9
    8.0.14



    
        org.springframework.boot
        spring-boot-starter-web
    

    
        io.zipkin.java
        zipkin-server
        ${zipkin.version}
        
            
                log4j-slf4j-impl
                org.apache.logging.log4j
            
        
    

    
        io.zipkin.java
        zipkin-autoconfigure-ui
        ${zipkin.version}
    

启动类
 

package com.example;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import zipkin2.server.internal.EnableZipkinServer;

@EnableZipkinServer
@SpringBootApplication
public class ZipkinServerApplication {

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

}

application.yml

server:
#  port: 9411
  compression:
    # 是否开启压缩 默认false
    enabled: true
spring:
  application:
    name: zipkin-server
  main:
    # 让应用以非web服务方式启动 server.port配置将会失效
    web-application-type: none

代码地址 https://github.com/tothis/spring-cloud-learn/tree/master/zipkin-server
 

你可能感兴趣的:(springcloud)