Skip to content
On this page

微服务调试

本地联调

  • 编写接口的@FeignClient注解,配置调用服务的URL地址

  • java
    package com.chinapost.logistics.service.business.feign;
    import  com.chinapost.logistics.service.api.constants.GlobalConstants;
    import  com.chinapost.logistics.service.api.feign.StandardProductApi;
    import  com.chinapost.logistics.service.business.handler.FeignRequestIterceptor;
    import  com.springframework.cloud.openfeign.FeignClient;
    
    @FeignClient(value = GlobalConstants.STANDARDPRODUCTPOLYMERIZE_MODULE_NAME,fallback = StandardProductClientImpl.class,configuration = FeignRequestIterceptor.class )
    public interface StandardProductClient extends StandardProductApi{
    }
    

feign

远程服务联调

  • 微服务治理平台探针配置

    yaml
    nsf:
      type: http
      version: '2.0'
      nsfServer: 'http://nsf-server.sgp-pre.chinapost.com.cn'
      application:
        name: standard-product-polymerize
        version: 0.0.1
        projectCode: yysys
        envCode: prod
        mark: ''
        zone: default
        group: default
        tags: []
      manager:
        patterns:
          -
            className: ""
      authority:
        accessKey: f66e84db109c4890b422be7cc32edd81
        secretKey: b8cfb432496b46c9acc352246a97dfe3y
    
  • 探针jar包配置

    nsf-boot.jar 包放到项目目录下

    agent

    调试运行配置

    java
    -javaagent:D:/nsf/nsf-boot.jar=standard-product-polyerize
    

    vm

    vm配置

    javaagent

  • 编写FeignClient接口 ,配置调用服务的URL :调用服务URL地址

java
package com.chinapost.logistics.service.business.feign;
import  com.chinapost.logistics.service.api.constants.GlobalConstants;
import  com.chinapost.logistics.service.api.feign.StandardProductApi;
import  com.chinapost.logistics.service.business.handler.FeignRequestIterceptor;
import  com.springframework.cloud.openfeign.FeignClient;

@FeignClient(value = GlobalConstants.STANDARDPRODUCTPOLYMERIZE_MODULE_NAME, fallback = StandardProductClientImpl.class,configuration = FeignRequestIterceptor.class )
public interface StandardProductClient extends StandardProductApi{
}

nacos