外贸网站怎么建设,建设网站注意事项,公司网站建站要多少钱,php 向网站发送数据目录
一、基础应用
1.feign使用
1.增加feign依赖
2.编写feign接口
3.启用feign
4.调试
5.可能出现的异常信息
1.404
可能原因:
2.503
可有原因:
2.feign自定义配置
1.创建Feign配置类
2.feign接口
3.调试结果
3.feign多参数请求
Feign是Netflix开发的声明…目录
一、基础应用
1.feign使用
1.增加feign依赖
2.编写feign接口
3.启用feign
4.调试
5.可能出现的异常信息
1.404
可能原因:
2.503
可有原因:
2.feign自定义配置
1.创建Feign配置类
2.feign接口
3.调试结果
3.feign多参数请求 Feign是Netflix开发的声明试、模版化的HTTP客户端,它调用HTTP API更加便捷优雅。
一、基础应用
1.feign使用
1.增加feign依赖
dependencygroupIdorg.springframework.cloud/groupIdartifactIdspring-cloud-starter-openfeign/artifactId
/dependency
2.编写feign接口
@FeignClient(name = "microservice-provider-user")
public interface UserFeignClient {@PostMapping("/api/user")String find();
}@FeignClient注解的name 是指定FeignClient的名称,如果项目使用了Ribbon\Consul等,name属性会作为微服务的名称,用于服务发现。还可以使用url可以手动指定@FeignClient调用的地址。
3.启用feign
启动类增加 @EnableFeignClients 注解
4.调试 @PostMapping("/serviceInstance")public String serviceInstance() {return userFeignClient.find();}结果:
[{"id":1,"username":"account1","name":"张三","age":20,"balance":150.00},
{"id":2,"username":"account2","name":"李四","age":25,"balance":350.00},
{"id":3,"username":"account3","name":"王五","age":28,"balance":450.00}]
5.可能出现的异常信息
1.404
feign.FeignException$NotFound: [404] during [GET] to [http://microservice-provider-user/user] [UserFeignClient#captchaImage()]: [!doctype htmlhtml lang="en"headtitleHTTP Status 404 – Not Found/titlestyle type="text/css"body {font