Added Feign Client.
This commit is contained in:
parent
d97a894f51
commit
9f3fba5298
1
pom.xml
1
pom.xml
|
@ -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>
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 {
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue