Giriş
Şu satırı dahil ederiz
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;import org.springframework.cloud.netflix.feign.EnableFeignClients;
Bu anotasyon @FeignClient anotasyonlarının taranması için gereklidir.
Örnek
Şöyle yaparız
basePackages Alanı@EnableDiscoveryClient@EnableFeignClients@SpringBootApplicationpublic class EmployeeDashBoardServiceApplication {public static void main(String[] args) {SpringApplication.run(EmployeeDashBoardServiceApplication.class, args);@Beanpublic RestTemplate restTemplate(RestTemplateBuilder builder) {return builder.build();}}
Örnek
Şöyle yaparız
@SpringBootApplication @EnableFeignClients("io.xrio.movies.controller.client") public class MoviesApplication { ... }
clients Alanı
Örnek
Şöyle yaparız
import org.springframework.boot.autoconfigure.SpringBootApplication;import org.springframework.cloud.openfeign.EnableFeignClients;import cz.zpapez.springfeignclients.slack.SlackFeignClient;import cz.zpapez.springfeignclients.zephyr.ZephyrFeignClient;@SpringBootApplication@EnableFeignClients(clients = {SlackFeignClient.class,ZephyrFeignClient.class})public class SpringFeignClientsApplication {public static void main(String[] args) {SpringApplication.run(SpringFeignClientsApplication.class, args);}}
Hiç yorum yok:
Yorum Gönder