forked from yudaocode/SpringBoot-Labs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
YunaiV
committed
Feb 11, 2020
1 parent
2369c1a
commit c85ca25
Showing
5 changed files
with
46 additions
and
62 deletions.
There are no files selected for viewing
8 changes: 0 additions & 8 deletions
8
...java/cn/iocoder/springcloud/labx03/feigndemo/consumer/conffig/OpenFeignConfiguration.java
This file was deleted.
Oops, something went wrong.
28 changes: 1 addition & 27 deletions
28
...c/main/java/cn/iocoder/springcloud/labx03/feigndemo/consumer/DemoConsumerApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,15 @@ | ||
package cn.iocoder.springcloud.labx03.feigndemo.consumer; | ||
|
||
import cn.iocoder.springcloud.labx03.feigndemo.consumer.feign.DemoProviderFeignClient; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
import org.springframework.cloud.openfeign.EnableFeignClients; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@SpringBootApplication | ||
@EnableFeignClients | ||
public class DemoConsumerApplication { | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(DemoConsumerApplication.class, args); | ||
} | ||
|
||
@Configuration | ||
@EnableFeignClients | ||
public class OpenFeignConfiguration { | ||
|
||
} | ||
|
||
@RestController | ||
static class TestController { | ||
|
||
@Autowired | ||
private DemoProviderFeignClient demoProviderFeignClient; | ||
|
||
@GetMapping("/hello02") | ||
public String hello02(String name) { | ||
// 使用 Feign 调用接口 | ||
String response = demoProviderFeignClient.echo(name); | ||
// 返回结果 | ||
return "consumer:" + response; | ||
} | ||
|
||
} | ||
|
||
} |
22 changes: 22 additions & 0 deletions
22
.../java/cn/iocoder/springcloud/labx03/feigndemo/consumer/controller/ConsumerController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package cn.iocoder.springcloud.labx03.feigndemo.consumer.controller; | ||
|
||
import cn.iocoder.springcloud.labx03.feigndemo.consumer.feign.DemoProviderFeignClient; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
public class ConsumerController { | ||
|
||
@Autowired | ||
private DemoProviderFeignClient demoProviderFeignClient; | ||
|
||
@GetMapping("/hello02") | ||
public String hello02(String name) { | ||
// 使用 Feign 调用接口 | ||
String response = demoProviderFeignClient.echo(name); | ||
// 返回结果 | ||
return "consumer:" + response; | ||
} | ||
|
||
} |
28 changes: 1 addition & 27 deletions
28
...c/main/java/cn/iocoder/springcloud/labx03/feigndemo/consumer/DemoConsumerApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,16 @@ | ||
package cn.iocoder.springcloud.labx03.feigndemo.consumer; | ||
|
||
import cn.iocoder.springcloud.labx03.feigndemo.consumer.config.DefaultFeignClientConfiguration; | ||
import cn.iocoder.springcloud.labx03.feigndemo.consumer.feign.DemoProviderFeignClient; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
import org.springframework.cloud.openfeign.EnableFeignClients; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@SpringBootApplication | ||
@EnableFeignClients(defaultConfiguration = DefaultFeignClientConfiguration.class) | ||
public class DemoConsumerApplication { | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(DemoConsumerApplication.class, args); | ||
} | ||
|
||
@Configuration | ||
@EnableFeignClients(defaultConfiguration = DefaultFeignClientConfiguration.class) | ||
public class OpenFeignConfiguration { | ||
|
||
} | ||
|
||
@RestController | ||
static class TestController { | ||
|
||
@Autowired | ||
private DemoProviderFeignClient demoProviderFeignClient; | ||
|
||
@GetMapping("/hello02") | ||
public String hello02(String name) { | ||
// 使用 Feign 调用接口 | ||
String response = demoProviderFeignClient.echo(name); | ||
// 返回结果 | ||
return "consumer:" + response; | ||
} | ||
|
||
} | ||
|
||
} |
22 changes: 22 additions & 0 deletions
22
.../java/cn/iocoder/springcloud/labx03/feigndemo/consumer/controller/ConsumerController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package cn.iocoder.springcloud.labx03.feigndemo.consumer.controller; | ||
|
||
import cn.iocoder.springcloud.labx03.feigndemo.consumer.feign.DemoProviderFeignClient; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
public class ConsumerController { | ||
|
||
@Autowired | ||
private DemoProviderFeignClient demoProviderFeignClient; | ||
|
||
@GetMapping("/hello02") | ||
public String hello02(String name) { | ||
// 使用 Feign 调用接口 | ||
String response = demoProviderFeignClient.echo(name); | ||
// 返回结果 | ||
return "consumer:" + response; | ||
} | ||
|
||
} |