Spring boot 프로젝트에 Spring Feign 을 사용하려면
Boot Applcation 에 @EnableFeignClients
어노테이션을 붙여준다.
Boot Applcation
...
import org.springframework.cloud.openfeign.EnableFeignClients;
@EnableFeignClients
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
pom.xml (Maven)
<!-- spring-cloud-starter-openfeign -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
추가적으로 Feign Client 정보는 application.yml
또는 Spring-Cloud Config
에 설정
application.yml
feign:
client:
...