0
【笔记】Feign学习笔记
source link: https://feiju12138.github.io/2022/10/24/Feign%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Feign is a Java to HTTP client binder inspired by Retrofit, JAXRS-2.0, and WebSocket. Feign’s first goal was reducing the complexity of binding Denominator uniformly to HTTP APIs regardless of ReSTfulness.(Github)
pom.xml
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
在主启动类添加注解
- 在主启动类上添加
@EnableFeignClients
启动Feign自动装配
package com;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
@EnableFeignClients
@SpringBootApplication
@MapperScan("com.dao")
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK