当前位置: 首页 > news >正文

微信网站名宁波网站建设设计价格

微信网站名,宁波网站建设设计价格,轻云服务器 安装wordpress,全国企业信用信息公开官网SpringCloud openFeign 之 获取被调用服务名 一. 概述 低版本 feign 只能获取到被调用方法的信息。 只有高版本 feign 才支持获取到被调用服务的信息。 二. 代码实现 package com.zxguan.springcloud2.template.user;import com.zxguan.springcloud2.template.user.config…

SpringCloud openFeign 之 获取被调用服务名

一. 概述

低版本 feign 只能获取到被调用方法的信息。

只有高版本 feign 才支持获取到被调用服务的信息。

二. 代码实现

package com.zxguan.springcloud2.template.user;import com.zxguan.springcloud2.template.user.config.TraceInterceptor;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;@EnableEurekaClient
@EnableFeignClients(value = "com.zxguan", defaultConfiguration = TraceInterceptor.class)
@SpringBootApplication()
public class UserApplication {public static void main(String[] args) {SpringApplication.run(UserApplication.class, args);}}
@Component
public class TraceInterceptor implements RequestInterceptor {@Overridepublic void apply(RequestTemplate requestTemplate) {Target target =  requestTemplate.feignTarget();System.out.println("==============>" + target.name());}}
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>2.2.8.RELEASE</version><relativePath/> <!-- lookup parent from repository --></parent><groupId>com.zxguan.springcloud2.template</groupId><artifactId>user</artifactId><version>0.0.1-SNAPSHOT</version><name>user</name><description>Demo project for Spring Boot</description><properties><java.version>1.8</java.version><spring-cloud.version>Finchley.RELEASE</spring-cloud.version><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding><maven.compiler.source>1.8</maven.compiler.source><maven.compiler.target>1.8</maven.compiler.target></properties><dependencies>        <!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-openfeign-core --><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-openfeign-core</artifactId><version>2.2.10.RELEASE</version></dependency><!-- https://mvnrepository.com/artifact/io.github.openfeign/feign-core --><dependency><groupId>io.github.openfeign</groupId><artifactId>feign-core</artifactId><version>11.0</version></dependency><!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-openfeign --><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-openfeign</artifactId><version>2.2.10.RELEASE</version></dependency><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-netflix-eureka-client</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-configuration-processor</artifactId><optional>true</optional></dependency><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><optional>true</optional></dependency><dependency><groupId>com.google.guava</groupId><artifactId>guava</artifactId><version>18.0</version></dependency></dependencies><dependencyManagement><dependencies><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-dependencies</artifactId><version>Finchley.RELEASE</version><type>pom</type><scope>import</scope></dependency></dependencies></dependencyManagement>
</project>

三. 特别注意

在升级 feign-core 版本后,可能会出现 java.lang.NoSuchMethodException 异常。这就说明有版本问题,此时需要定位到报错位置,将对应方法所属 jar 包调整到相应版本。

http://www.yayakq.cn/news/69399/

相关文章:

  • 重庆网站建设公司 十年新网站推广
  • wordpress手机双模板做网站需要知道优化吗
  • 网站建设域名未拿到小程序开发和app开发差别
  • 快乐无极网站西部数码网站管理助手 没有d盘
  • 大型网站建设制作个人工作室装修风格
  • 做一份网站的步zou工程建设企业网站
  • 旅游网站建设项目网站上的销售怎么做的
  • 电脑做试卷的网站织梦可以做视频网站么
  • ui设计师工作内容怎么写seo和点击付费的区别
  • 网站版式济南网站开发xywlcn
  • 福建省分行建设银行网站在网站上卖东西怎么做
  • 20m带宽做网站够用吗婚恋网站设计
  • 任县网站制作100 款软件app免费下载大全
  • seo站长工具综合查询家具设计师招聘
  • 网页美工素材百家港 seo服务
  • 怎么做网站子页wordpress new2主题使用
  • 常见的网站首页布局有哪几种做网站都需要哪些软件
  • 静态做网站德州做网站的公司
  • 顺德网站开发企业建设网站好吗
  • 网站ico怎么用网站建设的比较合理的流程
  • 网站建设犭金手指六六壹柒江都区城乡建设局网站马局
  • 建设网站的风险管理开源网站建设实习心得
  • 简述网站推广的方法管理咨询公司是做什么
  • 安装安全狗网站打不开万能视频下载工具
  • 英文域名在哪个网站查询dede 两个网站图片路径
  • 做商城网站哪个好产品推广方式
  • 泰安网站建设公司带广州做seo整站优化公司
  • 做电商网站前端的技术选型是软件定制合同
  • react做网站天津建设网站哪家好
  • 微山县建设局官方网站为什么wordpress安装成了英文版