Spring Cloud Alibaba之Nacos-服务消费者(Feign)
2021-03-27 21:25
标签:turn 查看 效果图 snapshot 视频 test tap cep htm Feign 是一个声明式的伪 Http 客户端,它使得写 Http 客户端变得更简单。使用 Feign,只需要创建一个接口并注解。它具有可插拔的注解特性,可使用 Feign 注解和 JAX-RS 注解。Feign 支持可插拔的编码器和解码器。Feign 默认集成了 Ribbon,Nacos 也很好的兼容了 Feign,默认实现了负载均衡的效果 Feign 采用的是基于接口的注解 Feign 整合了 ribbon 创建一个工程名为 概述
POM
hello-spring-cloud-alibaba-nacos-consumer-feign
的服务消费者项目,pom.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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
modelVersion>4.0.0modelVersion>
?
parent>
groupId>com.funtlgroupId>
artifactId>hello-spring-cloud-alibaba-dependenciesartifactId>
version>1.0.0-SNAPSHOTversion>
relativePath>../hello-spring-cloud-alibaba-dependencies/pom.xmlrelativePath>
parent>
?
artifactId>hello-spring-cloud-alibaba-nacos-consumer-feignartifactId>
packaging>jarpackaging>
?
name>hello-spring-cloud-alibaba-nacos-consumer-feignname>
url>http://www.funtl.comurl>
inceptionYear>2018-NowinceptionYear>
?
dependencies>
dependency>
groupId>org.springframework.bootgroupId>
artifactId>spring-boot-starter-webartifactId>
dependency>
dependency>
groupId>org.springframework.bootgroupId>
artifactId>spring-boot-starter-actuatorartifactId>
dependency>
dependency>
groupId>org.springframework.bootgroupId>
artifactId>spring-boot-starter-testartifactId>
scope>testscope>
dependency>
?
dependency>
groupId>org.springframework.cloudgroupId>
artifactId>spring-cloud-starter-alibaba-nacos-discoveryartifactId>
dependency>
dependency>
groupId>org.springframework.cloudgroupId>
artifactId>spring-cloud-starter-openfeignartifactId>
dependency>
dependencies>
?
build>
plugins>
plugin>
文章标题:Spring Cloud Alibaba之Nacos-服务消费者(Feign)
文章链接:http://soscw.com/essay/68741.html