Added Feign Client.

This commit is contained in:
Christian Rädel 2016-08-17 21:33:43 +02:00
parent d97a894f51
commit 9f3fba5298
5 changed files with 4 additions and 5 deletions

View File

@ -85,6 +85,7 @@
<module>spring-rest-angular-pagination</module> <module>spring-rest-angular-pagination</module>
<module>spring-rest-docs</module> <module>spring-rest-docs</module>
<module>spring-cloud-config</module> <module>spring-cloud-config</module>
<module>spring-cloud-eureka</module>
<module>spring-security-basic-auth</module> <module>spring-security-basic-auth</module>
<module>spring-security-custom-permission</module> <module>spring-security-custom-permission</module>

View File

@ -7,7 +7,7 @@
<version>1.0.0-SNAPSHOT</version> <version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>Spring Cloud Eureka - Feign Client</name> <name>Spring Cloud Eureka Feign Client</name>
<description>Spring Cloud Eureka - Sample Feign Client</description> <description>Spring Cloud Eureka - Sample Feign Client</description>
<parent> <parent>

View File

@ -1,12 +1,10 @@
package com.baeldung.spring.cloud.feign.client; package com.baeldung.spring.cloud.feign.client;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient; import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.feign.EnableFeignClients; import org.springframework.cloud.netflix.feign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@ -26,6 +24,6 @@ public class FeignClientApplication {
@RequestMapping("/get-greeting") @RequestMapping("/get-greeting")
public String greeting(Model model) { public String greeting(Model model) {
model.addAttribute("greeting", greetingClient.greeting()); model.addAttribute("greeting", greetingClient.greeting());
return "show-greeting"; return "greeting-view";
} }
} }

View File

@ -3,6 +3,6 @@ package com.baeldung.spring.cloud.feign.client;
import com.baeldung.spring.cloud.eureka.client.GreetingController; import com.baeldung.spring.cloud.eureka.client.GreetingController;
import org.springframework.cloud.netflix.feign.FeignClient; import org.springframework.cloud.netflix.feign.FeignClient;
@FeignClient("spring-eureka-client") @FeignClient("spring-cloud-eureka-client")
public interface GreetingClient extends GreetingController { public interface GreetingClient extends GreetingController {
} }