├── spring-cloud-learn
├── cloud-zuul
│ ├── target
│ │ └── classes
│ │ │ ├── com
│ │ │ └── cloud
│ │ │ │ └── zuul
│ │ │ │ ├── MyFilter.class
│ │ │ │ └── ZuulApplication.class
│ │ │ └── application.yml
│ ├── src
│ │ └── main
│ │ │ ├── resources
│ │ │ └── application.yml
│ │ │ └── java
│ │ │ └── com
│ │ │ └── cloud
│ │ │ └── zuul
│ │ │ ├── ZuulApplication.java
│ │ │ └── MyFilter.java
│ ├── pom.xml
│ └── cloud-zuul.iml
├── cloud-config
│ ├── target
│ │ └── classes
│ │ │ ├── com
│ │ │ └── cloud
│ │ │ │ └── config
│ │ │ │ └── ConfigApplication.class
│ │ │ └── application.yml
│ ├── src
│ │ └── main
│ │ │ ├── resources
│ │ │ └── application.yml
│ │ │ └── java
│ │ │ └── com
│ │ │ └── cloud
│ │ │ └── config
│ │ │ └── ConfigApplication.java
│ ├── pom.xml
│ └── cloud-config.iml
├── cloud-consumer
│ ├── target
│ │ └── classes
│ │ │ ├── com
│ │ │ └── cloud
│ │ │ │ └── consumer
│ │ │ │ ├── HelloService.class
│ │ │ │ ├── HelloController.class
│ │ │ │ └── ConsumerApplication.class
│ │ │ └── application.yml
│ ├── src
│ │ └── main
│ │ │ ├── resources
│ │ │ └── application.yml
│ │ │ └── java
│ │ │ └── com
│ │ │ └── cloud
│ │ │ └── consumer
│ │ │ ├── HelloController.java
│ │ │ ├── HelloService.java
│ │ │ └── ConsumerApplication.java
│ ├── pom.xml
│ └── cloud-consumer.iml
├── cloud-eureka
│ ├── target
│ │ └── classes
│ │ │ ├── com
│ │ │ └── cloud
│ │ │ │ └── eureka
│ │ │ │ └── EurekaApplication.class
│ │ │ └── application.yml
│ ├── src
│ │ └── main
│ │ │ ├── resources
│ │ │ └── application.yml
│ │ │ └── java
│ │ │ └── com
│ │ │ └── cloud
│ │ │ └── eureka
│ │ │ └── EurekaApplication.java
│ ├── pom.xml
│ └── cloud-eureka.iml
├── cloud-gateway
│ ├── target
│ │ └── classes
│ │ │ ├── com
│ │ │ └── cloud
│ │ │ │ └── gateway
│ │ │ │ └── GatewayApplication.class
│ │ │ └── application.yml
│ ├── pom.xml
│ ├── src
│ │ └── main
│ │ │ ├── java
│ │ │ └── com
│ │ │ │ └── cloud
│ │ │ │ └── gateway
│ │ │ │ └── GatewayApplication.java
│ │ │ └── resources
│ │ │ └── application.yml
│ └── cloud-gateway.iml
├── cloud-predict
│ ├── target
│ │ └── classes
│ │ │ ├── com
│ │ │ └── cloud
│ │ │ │ └── predict
│ │ │ │ └── PredictApplication.class
│ │ │ └── application.yml
│ ├── src
│ │ └── main
│ │ │ ├── resources
│ │ │ └── application.yml
│ │ │ └── java
│ │ │ └── com
│ │ │ └── cloud
│ │ │ └── predict
│ │ │ └── PredictApplication.java
│ ├── pom.xml
│ └── cloud-predict.iml
├── cloud-service
│ ├── target
│ │ └── classes
│ │ │ ├── com
│ │ │ └── cloud
│ │ │ │ └── service
│ │ │ │ └── ServiceApplication.class
│ │ │ └── application.yml
│ ├── src
│ │ └── main
│ │ │ ├── resources
│ │ │ └── application.yml
│ │ │ └── java
│ │ │ └── com
│ │ │ └── cloud
│ │ │ └── service
│ │ │ └── ServiceApplication.java
│ ├── pom.xml
│ └── cloud-service.iml
├── cloud-service2
│ ├── target
│ │ └── classes
│ │ │ ├── com
│ │ │ └── cloud
│ │ │ │ └── service2
│ │ │ │ └── Service2Application.class
│ │ │ └── application.yml
│ ├── src
│ │ └── main
│ │ │ ├── resources
│ │ │ └── application.yml
│ │ │ └── java
│ │ │ └── com
│ │ │ └── cloud
│ │ │ └── service2
│ │ │ └── Service2Application.java
│ ├── pom.xml
│ └── cloud-service2.iml
├── cloud-consumer-feign
│ ├── target
│ │ └── classes
│ │ │ ├── com
│ │ │ └── cloud
│ │ │ │ └── consumer
│ │ │ │ └── feign
│ │ │ │ ├── IHelloService.class
│ │ │ │ ├── FeignApplication.class
│ │ │ │ ├── HelloController.class
│ │ │ │ └── HelloServiceHystric.class
│ │ │ └── application.yml
│ ├── src
│ │ └── main
│ │ │ ├── resources
│ │ │ └── application.yml
│ │ │ └── java
│ │ │ └── com
│ │ │ └── cloud
│ │ │ └── consumer
│ │ │ └── feign
│ │ │ ├── HelloServiceHystric.java
│ │ │ ├── HelloController.java
│ │ │ ├── IHelloService.java
│ │ │ └── FeignApplication.java
│ ├── pom.xml
│ └── cloud-consumer-feign.iml
├── cloud-config-client
│ ├── target
│ │ └── classes
│ │ │ ├── com
│ │ │ └── cloud
│ │ │ │ └── config
│ │ │ │ └── client
│ │ │ │ └── ConfigClientApplication.class
│ │ │ └── bootstrap.properties
│ ├── src
│ │ └── main
│ │ │ ├── resources
│ │ │ └── bootstrap.properties
│ │ │ └── java
│ │ │ └── com
│ │ │ └── cloud
│ │ │ └── config
│ │ │ └── client
│ │ │ └── ConfigClientApplication.java
│ ├── pom.xml
│ └── cloud-config-client.iml
├── pom.xml
└── sping-cloud-learn.iml
└── README.md
/spring-cloud-learn/cloud-zuul/target/classes/com/cloud/zuul/MyFilter.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/githubweili/springcloud/HEAD/spring-cloud-learn/cloud-zuul/target/classes/com/cloud/zuul/MyFilter.class
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-zuul/target/classes/com/cloud/zuul/ZuulApplication.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/githubweili/springcloud/HEAD/spring-cloud-learn/cloud-zuul/target/classes/com/cloud/zuul/ZuulApplication.class
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-config/target/classes/com/cloud/config/ConfigApplication.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/githubweili/springcloud/HEAD/spring-cloud-learn/cloud-config/target/classes/com/cloud/config/ConfigApplication.class
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-consumer/target/classes/com/cloud/consumer/HelloService.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/githubweili/springcloud/HEAD/spring-cloud-learn/cloud-consumer/target/classes/com/cloud/consumer/HelloService.class
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-eureka/target/classes/com/cloud/eureka/EurekaApplication.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/githubweili/springcloud/HEAD/spring-cloud-learn/cloud-eureka/target/classes/com/cloud/eureka/EurekaApplication.class
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-consumer/target/classes/com/cloud/consumer/HelloController.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/githubweili/springcloud/HEAD/spring-cloud-learn/cloud-consumer/target/classes/com/cloud/consumer/HelloController.class
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-gateway/target/classes/com/cloud/gateway/GatewayApplication.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/githubweili/springcloud/HEAD/spring-cloud-learn/cloud-gateway/target/classes/com/cloud/gateway/GatewayApplication.class
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-predict/target/classes/com/cloud/predict/PredictApplication.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/githubweili/springcloud/HEAD/spring-cloud-learn/cloud-predict/target/classes/com/cloud/predict/PredictApplication.class
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-service/target/classes/com/cloud/service/ServiceApplication.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/githubweili/springcloud/HEAD/spring-cloud-learn/cloud-service/target/classes/com/cloud/service/ServiceApplication.class
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-consumer/target/classes/com/cloud/consumer/ConsumerApplication.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/githubweili/springcloud/HEAD/spring-cloud-learn/cloud-consumer/target/classes/com/cloud/consumer/ConsumerApplication.class
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-service2/target/classes/com/cloud/service2/Service2Application.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/githubweili/springcloud/HEAD/spring-cloud-learn/cloud-service2/target/classes/com/cloud/service2/Service2Application.class
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-consumer-feign/target/classes/com/cloud/consumer/feign/IHelloService.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/githubweili/springcloud/HEAD/spring-cloud-learn/cloud-consumer-feign/target/classes/com/cloud/consumer/feign/IHelloService.class
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-consumer-feign/target/classes/com/cloud/consumer/feign/FeignApplication.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/githubweili/springcloud/HEAD/spring-cloud-learn/cloud-consumer-feign/target/classes/com/cloud/consumer/feign/FeignApplication.class
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-consumer-feign/target/classes/com/cloud/consumer/feign/HelloController.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/githubweili/springcloud/HEAD/spring-cloud-learn/cloud-consumer-feign/target/classes/com/cloud/consumer/feign/HelloController.class
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-config-client/target/classes/com/cloud/config/client/ConfigClientApplication.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/githubweili/springcloud/HEAD/spring-cloud-learn/cloud-config-client/target/classes/com/cloud/config/client/ConfigClientApplication.class
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-consumer-feign/target/classes/com/cloud/consumer/feign/HelloServiceHystric.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/githubweili/springcloud/HEAD/spring-cloud-learn/cloud-consumer-feign/target/classes/com/cloud/consumer/feign/HelloServiceHystric.class
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-service/target/classes/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8085
3 |
4 | spring:
5 | application:
6 | name: cloud-service
7 |
8 | eureka:
9 | client:
10 | serviceUrl:
11 | defaultZone: http://localhost:8081/eureka/
12 |
13 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-consumer/target/classes/application.yml:
--------------------------------------------------------------------------------
1 | eureka:
2 | client:
3 | serviceUrl:
4 | defaultZone: http://localhost:8081/eureka/
5 | server:
6 | port: 8083
7 | spring:
8 | application:
9 | name: cloud-consumer
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-service/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8085
3 |
4 | spring:
5 | application:
6 | name: cloud-service
7 |
8 | eureka:
9 | client:
10 | serviceUrl:
11 | defaultZone: http://localhost:8081/eureka/
12 |
13 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-service2/target/classes/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8086
3 |
4 | spring:
5 | application:
6 | name: cloud-service2
7 |
8 | eureka:
9 | client:
10 | serviceUrl:
11 | defaultZone: http://localhost:8081/eureka/
12 |
13 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-consumer/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | eureka:
2 | client:
3 | serviceUrl:
4 | defaultZone: http://localhost:8081/eureka/
5 | server:
6 | port: 8083
7 | spring:
8 | application:
9 | name: cloud-consumer
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-service2/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8086
3 |
4 | spring:
5 | application:
6 | name: cloud-service2
7 |
8 | eureka:
9 | client:
10 | serviceUrl:
11 | defaultZone: http://localhost:8081/eureka/
12 |
13 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-consumer-feign/target/classes/application.yml:
--------------------------------------------------------------------------------
1 | eureka:
2 | client:
3 | serviceUrl:
4 | defaultZone: http://localhost:8081/eureka/
5 | server:
6 | port: 8086
7 | spring:
8 | application:
9 | name: cloud-consumer-feign
10 | feign:
11 | hystrix:
12 | enabled: true
13 |
14 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-consumer-feign/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | eureka:
2 | client:
3 | serviceUrl:
4 | defaultZone: http://localhost:8081/eureka/
5 | server:
6 | port: 8086
7 | spring:
8 | application:
9 | name: cloud-consumer-feign
10 | feign:
11 | hystrix:
12 | enabled: true
13 |
14 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-eureka/target/classes/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8081
3 |
4 | eureka:
5 | instance:
6 | hostname: localhost
7 | client:
8 | serviceUrl:
9 | defaultZone: http://localhost2:8082/eureka/
10 |
11 | spring:
12 | application:
13 | name: eurka-server
14 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-eureka/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8081
3 |
4 | eureka:
5 | instance:
6 | hostname: localhost
7 | client:
8 | serviceUrl:
9 | defaultZone: http://localhost2:8082/eureka/
10 |
11 | spring:
12 | application:
13 | name: eurka-server
14 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-predict/target/classes/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8080
3 | spring:
4 | profiles:
5 | active: header_route
6 |
7 | ---
8 | spring:
9 | cloud:
10 | gateway:
11 |
12 | routes:
13 | - id: header_route
14 | uri: http://localhost:8085/hello
15 | predicates:
16 | - Header=X-Request-Id, \d+
17 | profiles: header_route
18 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-config/target/classes/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8889
3 |
4 | spring:
5 | application:
6 | name: cloud-config
7 | cloud:
8 | config:
9 | server:
10 | git:
11 | uri: https://github.com/githubweili/cloud-config
12 |
13 | eureka:
14 | client:
15 | serviceUrl:
16 | defaultZone: http://localhost:8081/eureka/
17 |
18 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-predict/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8080
3 | spring:
4 | profiles:
5 | active: header_route
6 |
7 | ---
8 | spring:
9 | cloud:
10 | gateway:
11 |
12 | routes:
13 | - id: header_route
14 | uri: http://localhost:8085/hello
15 | predicates:
16 | - Header=X-Request-Id, \d+
17 | profiles: header_route
18 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-config/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8889
3 |
4 | spring:
5 | application:
6 | name: cloud-config
7 | cloud:
8 | config:
9 | server:
10 | git:
11 | uri: https://github.com/githubweili/cloud-config
12 |
13 | eureka:
14 | client:
15 | serviceUrl:
16 | defaultZone: http://localhost:8081/eureka/
17 |
18 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-zuul/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | eureka:
2 | client:
3 | serviceUrl:
4 | defaultZone: http://localhost:8081/eureka/
5 | server:
6 | port: 8007
7 | spring:
8 | application:
9 | name: cloud-zuul
10 | zuul:
11 | routes:
12 | api-a:
13 | path: /api-a/**
14 | serviceId: cloud-service
15 | api-b:
16 | path: /api-b/**
17 | serviceId: cloud-service2
18 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-zuul/target/classes/application.yml:
--------------------------------------------------------------------------------
1 | eureka:
2 | client:
3 | serviceUrl:
4 | defaultZone: http://localhost:8081/eureka/
5 | server:
6 | port: 8007
7 | spring:
8 | application:
9 | name: cloud-zuul
10 | zuul:
11 | routes:
12 | api-a:
13 | path: /api-a/**
14 | serviceId: cloud-service
15 | api-b:
16 | path: /api-b/**
17 | serviceId: cloud-service2
18 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-consumer-feign/src/main/java/com/cloud/consumer/feign/HelloServiceHystric.java:
--------------------------------------------------------------------------------
1 | package com.cloud.consumer.feign;
2 |
3 | import org.springframework.stereotype.Component;
4 | import org.springframework.web.bind.annotation.RequestParam;
5 |
6 | /**
7 | * Created by wei.li
8 | * on 2019/2/27
9 | */
10 | @Component
11 | public class HelloServiceHystric implements IHelloService {
12 |
13 | @Override
14 | public String hello(@RequestParam(value = "name") String name) {
15 | return "feign, error";
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-eureka/src/main/java/com/cloud/eureka/EurekaApplication.java:
--------------------------------------------------------------------------------
1 | package com.cloud.eureka;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
6 |
7 | /**
8 | * Created by wei.li
9 | * on 2019/2/26
10 | */
11 |
12 | @SpringBootApplication
13 | @EnableEurekaServer
14 | public class EurekaApplication {
15 |
16 | public static void main(String[] args) {
17 | SpringApplication.run(EurekaApplication.class, args);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-predict/src/main/java/com/cloud/predict/PredictApplication.java:
--------------------------------------------------------------------------------
1 | package com.cloud.predict;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.web.bind.annotation.RestController;
6 |
7 | /**
8 | * Created by wei.li
9 | * on 2019/3/4
10 | */
11 |
12 | @SpringBootApplication
13 | @RestController
14 | public class PredictApplication {
15 |
16 | public static void main(String[] args) {
17 | SpringApplication.run(PredictApplication.class, args);
18 | }
19 |
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-config/src/main/java/com/cloud/config/ConfigApplication.java:
--------------------------------------------------------------------------------
1 | package com.cloud.config;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.cloud.config.server.EnableConfigServer;
6 | import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
7 |
8 | /**
9 | * Created by wei.li
10 | * on 2019/2/27
11 | */
12 |
13 | @SpringBootApplication
14 | @EnableConfigServer
15 | @EnableEurekaClient
16 | public class ConfigApplication {
17 |
18 |
19 | public static void main(String[] args) {
20 | SpringApplication.run(ConfigApplication.class, args);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-consumer/src/main/java/com/cloud/consumer/HelloController.java:
--------------------------------------------------------------------------------
1 | package com.cloud.consumer;
2 |
3 | import org.springframework.beans.factory.annotation.Autowired;
4 | import org.springframework.web.bind.annotation.GetMapping;
5 | import org.springframework.web.bind.annotation.RequestParam;
6 | import org.springframework.web.bind.annotation.RestController;
7 |
8 | /**
9 | * Created by wei.li
10 | * on 2019/2/26
11 | */
12 |
13 | @RestController
14 | public class HelloController {
15 |
16 | @Autowired
17 | HelloService helloService;
18 |
19 |
20 | @GetMapping(value = "hello")
21 | public String hello(@RequestParam String name){
22 | return helloService.hello(name);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-consumer-feign/src/main/java/com/cloud/consumer/feign/HelloController.java:
--------------------------------------------------------------------------------
1 | package com.cloud.consumer.feign;
2 |
3 | import org.springframework.beans.factory.annotation.Autowired;
4 | import org.springframework.web.bind.annotation.GetMapping;
5 | import org.springframework.web.bind.annotation.RequestParam;
6 | import org.springframework.web.bind.annotation.RestController;
7 |
8 | /**
9 | * Created by wei.li
10 | * on 2019/2/26
11 | */
12 |
13 | @RestController
14 | public class HelloController {
15 |
16 | @Autowired
17 | IHelloService helloService;
18 |
19 | @GetMapping(value = "hello")
20 | public String hello(@RequestParam String name){
21 | return helloService.hello(name);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-config-client/src/main/resources/bootstrap.properties:
--------------------------------------------------------------------------------
1 | spring.application.name=cloud-config-client
2 | spring.cloud.config.label=master
3 | spring.cloud.config.profile=dev
4 | #spring.cloud.config.uri= http://localhost:8888/
5 | spring.cloud.config.name=config-client
6 |
7 | eureka.client.serviceUrl.defaultZone=http://localhost:8081/eureka/
8 | spring.cloud.config.discovery.enabled=true
9 | spring.cloud.config.discovery.serviceId=cloud-config
10 | server.port=8882
11 |
12 | spring.rabbitmq.host=localhost
13 | spring.rabbitmq.port=5672
14 | spring.rabbitmq.username=guest
15 | spring.rabbitmq.password=guest
16 |
17 | spring.cloud.bus.enabled=true
18 | spring.cloud.bus.trace.enabled=true
19 | management.endpoints.web.exposure.include=bus-refresh
20 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-config-client/target/classes/bootstrap.properties:
--------------------------------------------------------------------------------
1 | spring.application.name=cloud-config-client
2 | spring.cloud.config.label=master
3 | spring.cloud.config.profile=dev
4 | #spring.cloud.config.uri= http://localhost:8888/
5 | spring.cloud.config.name=config-client
6 |
7 | eureka.client.serviceUrl.defaultZone=http://localhost:8081/eureka/
8 | spring.cloud.config.discovery.enabled=true
9 | spring.cloud.config.discovery.serviceId=cloud-config
10 | server.port=8882
11 |
12 | spring.rabbitmq.host=localhost
13 | spring.rabbitmq.port=5672
14 | spring.rabbitmq.username=guest
15 | spring.rabbitmq.password=guest
16 |
17 | spring.cloud.bus.enabled=true
18 | spring.cloud.bus.trace.enabled=true
19 | management.endpoints.web.exposure.include=bus-refresh
20 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-consumer-feign/src/main/java/com/cloud/consumer/feign/IHelloService.java:
--------------------------------------------------------------------------------
1 | package com.cloud.consumer.feign;
2 |
3 | import org.springframework.beans.factory.annotation.Value;
4 | import org.springframework.cloud.openfeign.FeignClient;
5 | import org.springframework.web.bind.annotation.RequestMapping;
6 | import org.springframework.web.bind.annotation.RequestMethod;
7 | import org.springframework.web.bind.annotation.RequestParam;
8 |
9 | /**
10 | * Created by wei.li
11 | * on 2019/2/26
12 | */
13 |
14 | @FeignClient(value = "cloud-zuul", fallback = HelloServiceHystric.class)
15 | public interface IHelloService {
16 |
17 | @RequestMapping(value = "api-a/hello", method = RequestMethod.GET)
18 | String hello(@RequestParam(value = "name") String name);
19 | }
20 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-zuul/src/main/java/com/cloud/zuul/ZuulApplication.java:
--------------------------------------------------------------------------------
1 | package com.cloud.zuul;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
6 | import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
7 | import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
8 |
9 | /**
10 | * Created by wei.li
11 | * on 2019/2/27
12 | */
13 |
14 | @SpringBootApplication
15 | @EnableZuulProxy
16 | @EnableEurekaClient
17 | @EnableDiscoveryClient
18 | public class ZuulApplication {
19 |
20 | public static void main(String[] args) {
21 | SpringApplication.run(ZuulApplication.class, args);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-consumer-feign/src/main/java/com/cloud/consumer/feign/FeignApplication.java:
--------------------------------------------------------------------------------
1 | package com.cloud.consumer.feign;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
6 | import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
7 | import org.springframework.cloud.openfeign.EnableFeignClients;
8 |
9 | /**
10 | * Created by wei.li
11 | * on 2019/2/26
12 | */
13 |
14 | @SpringBootApplication
15 | @EnableEurekaClient
16 | @EnableDiscoveryClient
17 | @EnableFeignClients
18 | public class FeignApplication {
19 |
20 | public static void main(String[] args) {
21 | SpringApplication.run(FeignApplication.class, args);
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-consumer/src/main/java/com/cloud/consumer/HelloService.java:
--------------------------------------------------------------------------------
1 | package com.cloud.consumer;
2 |
3 | import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
4 | import org.springframework.beans.factory.annotation.Autowired;
5 | import org.springframework.stereotype.Service;
6 | import org.springframework.web.client.RestTemplate;
7 |
8 | /**
9 | * Created by wei.li
10 | * on 2019/2/26
11 | */
12 |
13 | @Service
14 | public class HelloService {
15 |
16 | @Autowired
17 | RestTemplate restTemplate;
18 |
19 | @HystrixCommand(fallbackMethod = "error")
20 | public String hello(String name){
21 | return restTemplate.getForObject("http://CLOUD-SERVICE/hello?name="+name, String.class);
22 | }
23 |
24 | public String error(String name){
25 | return "sorry, error";
26 | }
27 | }
28 |
29 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-eureka/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | sping-cloud-learn
7 | com.cloud
8 | 1.0-SNAPSHOT
9 |
10 | 4.0.0
11 |
12 | com.cloud
13 | cloud-eureka
14 | 1.0-SNAPSHOT
15 | jar
16 |
17 |
18 |
19 | org.springframework.cloud
20 | spring-cloud-starter-netflix-eureka-server
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-service2/src/main/java/com/cloud/service2/Service2Application.java:
--------------------------------------------------------------------------------
1 | package com.cloud.service2;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
6 | import org.springframework.web.bind.annotation.RequestMapping;
7 | import org.springframework.web.bind.annotation.RequestParam;
8 | import org.springframework.web.bind.annotation.RestController;
9 |
10 | /**
11 | * Created by wei.li
12 | * on 2019/2/27
13 | */
14 |
15 | @SpringBootApplication
16 | @EnableEurekaClient
17 | @RestController
18 | public class Service2Application {
19 |
20 |
21 | public static void main(String[] args) {
22 | SpringApplication.run(Service2Application.class, args);
23 | }
24 |
25 |
26 | @RequestMapping(value = "hello")
27 | public String hello(@RequestParam(value = "name", defaultValue = "2") String name){
28 | return "hello, 2";
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-consumer/src/main/java/com/cloud/consumer/ConsumerApplication.java:
--------------------------------------------------------------------------------
1 | package com.cloud.consumer;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
6 | import org.springframework.cloud.client.loadbalancer.LoadBalanced;
7 | import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
8 | import org.springframework.cloud.netflix.hystrix.EnableHystrix;
9 | import org.springframework.context.annotation.Bean;
10 | import org.springframework.web.client.RestTemplate;
11 |
12 | /**
13 | * Created by wei.li
14 | * on 2019/2/26
15 | */
16 |
17 | @SpringBootApplication
18 | @EnableEurekaClient
19 | @EnableDiscoveryClient
20 | @EnableHystrix
21 | public class ConsumerApplication {
22 |
23 | public static void main(String[] args) {
24 | SpringApplication.run(ConsumerApplication.class, args);
25 | }
26 |
27 | @Bean
28 | @LoadBalanced
29 | RestTemplate restTemplate(){
30 | return new RestTemplate();
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-gateway/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | sping-cloud-learn
7 | com.cloud
8 | 1.0-SNAPSHOT
9 |
10 | 4.0.0
11 |
12 | com.cloud
13 | cloud-gateway
14 | 1.0-SNAPSHOT
15 | jar
16 |
17 |
18 |
19 | org.springframework.cloud
20 | spring-cloud-starter-gateway
21 |
22 |
23 | org.springframework.cloud
24 | spring-cloud-starter-netflix-hystrix
25 |
26 |
27 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-config-client/src/main/java/com/cloud/config/client/ConfigClientApplication.java:
--------------------------------------------------------------------------------
1 | package com.cloud.config.client;
2 |
3 | import org.springframework.beans.factory.annotation.Value;
4 | import org.springframework.boot.SpringApplication;
5 | import org.springframework.boot.autoconfigure.SpringBootApplication;
6 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
7 | import org.springframework.cloud.context.config.annotation.RefreshScope;
8 | import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
9 | import org.springframework.web.bind.annotation.RequestMapping;
10 | import org.springframework.web.bind.annotation.RestController;
11 |
12 | @SpringBootApplication
13 | @EnableEurekaClient
14 | @EnableDiscoveryClient
15 | @RestController
16 | @RefreshScope
17 | public class ConfigClientApplication {
18 |
19 | public static void main(String[] args) {
20 | SpringApplication.run(ConfigClientApplication.class, args);
21 | }
22 |
23 | @Value("${foo}")
24 | String foo;
25 | @RequestMapping(value = "/hi")
26 | public String hi(){
27 | return foo;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-zuul/src/main/java/com/cloud/zuul/MyFilter.java:
--------------------------------------------------------------------------------
1 | package com.cloud.zuul;
2 |
3 | import com.netflix.zuul.ZuulFilter;
4 | import com.netflix.zuul.context.RequestContext;
5 | import com.netflix.zuul.exception.ZuulException;
6 | import org.springframework.stereotype.Component;
7 |
8 | import javax.servlet.http.HttpServletRequest;
9 | import javax.servlet.http.HttpServletResponse;
10 |
11 | /**
12 | * Created by wei.li
13 | * on 2019/3/12
14 | */
15 | @Component
16 | public class MyFilter extends ZuulFilter{
17 |
18 |
19 | @Override
20 | public String filterType() {
21 | return "pre";
22 | }
23 |
24 | @Override
25 | public int filterOrder() {
26 | return 0;
27 | }
28 |
29 | @Override
30 | public boolean shouldFilter() {
31 | return true;
32 | }
33 |
34 | @Override
35 | public Object run() throws ZuulException {
36 | RequestContext requestContext = RequestContext.getCurrentContext();
37 | HttpServletResponse response = requestContext.getResponse();
38 | response.setHeader("header", "test");
39 | return null;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-service/src/main/java/com/cloud/service/ServiceApplication.java:
--------------------------------------------------------------------------------
1 | package com.cloud.service;
2 |
3 | import org.springframework.beans.factory.annotation.Value;
4 | import org.springframework.boot.SpringApplication;
5 | import org.springframework.boot.autoconfigure.SpringBootApplication;
6 | import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
7 | import org.springframework.web.bind.annotation.RequestMapping;
8 | import org.springframework.web.bind.annotation.RequestParam;
9 | import org.springframework.web.bind.annotation.RestController;
10 |
11 | /**
12 | * Created by wei.li
13 | * on 2019/2/26
14 | */
15 |
16 | @SpringBootApplication
17 | @EnableEurekaClient
18 | @RestController
19 | public class ServiceApplication {
20 |
21 | public static void main(String[] args) {
22 | SpringApplication.run(ServiceApplication.class, args);
23 | }
24 |
25 | @Value("${server.port}")
26 | String port;
27 |
28 | @RequestMapping("hello")
29 | public String hello(@RequestParam(value = "name", defaultValue = "forwei") String name){
30 | return "hello" + name + ", i am from port:" + port;
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # 把代码写成诗系列--springcloud学习资料
2 |
3 | - [springcloud学习第一章:微服务的理解 ](https://www.jianshu.com/p/9611a30651d0)
4 | - [springcloud学习第二章:服务治理中心eureka ]( https://www.jianshu.com/p/4270559df18e)
5 | - [springcloud学习第三章:负载均衡器ribbon]( https://www.jianshu.com/p/a7b028feb12b)
6 | - [springcloud学习第五章:熔断器hystrix]( https://www.jianshu.com/p/20eb27e5e123)
7 | - [springcloud学习第四章:服务调用feign]( https://www.jianshu.com/p/08479041a92a)
8 | - [springcloud学习第六章:网关zuul]( https://www.jianshu.com/p/578eb80fc772)
9 | - [springcloud学习第七章:网关gateway](https://www.jianshu.com/p/7885ca0bc228)
10 | - [springcloud学习第八章:网关GatewayFilter](https://www.jianshu.com/p/4566d97aea24)
11 | - [springcloud学习第九章:配置中心config](https://www.jianshu.com/p/08cb5544f1b4)
12 | - [springcloud学习第十章:配置中心config集群](https://www.jianshu.com/p/819f093cc1f5)
13 | - [springcloud学习第十一章:服务治理中心eureka集群](https://www.jianshu.com/p/08cb5544f1b4)
14 |
15 | # 把代码写成诗系列--高可用
16 | - [lvs+keepalived+nginx高可用主从热备 ](https://www.jianshu.com/p/9e3f3c96ac40)
17 | - [一次支付回调的优化](https://www.jianshu.com/p/a9cb3c078a87)
18 | **欢迎关注 沟通交流**
19 | 
20 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-zuul/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | sping-cloud-learn
7 | com.cloud
8 | 1.0-SNAPSHOT
9 |
10 | 4.0.0
11 |
12 | com.cloud
13 | 1.0-SNAPSHOT
14 | cloud-zuul
15 | jar
16 |
17 |
18 |
19 | org.springframework.cloud
20 | spring-cloud-starter-netflix-eureka-client
21 |
22 |
23 | org.springframework.boot
24 | spring-boot-starter-web
25 |
26 |
27 | org.springframework.cloud
28 | spring-cloud-starter-netflix-zuul
29 |
30 |
31 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-consumer-feign/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | sping-cloud-learn
7 | com.cloud
8 | 1.0-SNAPSHOT
9 |
10 | 4.0.0
11 |
12 | com.cloud
13 | cloud-consumer-feign
14 | 1.0-SNAPSHOT
15 | jar
16 |
17 |
18 |
19 |
20 | org.springframework.cloud
21 | spring-cloud-starter-netflix-eureka-client
22 |
23 |
24 | org.springframework.boot
25 | spring-boot-starter-web
26 |
27 |
28 | org.springframework.cloud
29 | spring-cloud-starter-openfeign
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-predict/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | sping-cloud-learn
7 | com.cloud
8 | 1.0-SNAPSHOT
9 |
10 | 4.0.0
11 |
12 | com.cloud
13 | cloud-predict
14 | 1.0-SNAPSHOT
15 | jar
16 |
17 |
18 |
19 |
20 | org.springframework.cloud
21 | spring-cloud-starter-gateway
22 |
23 |
24 | org.springframework.cloud
25 | spring-cloud-starter-netflix-hystrix
26 |
27 |
28 | org.springframework.boot
29 | spring-boot-starter-test
30 | test
31 |
32 |
33 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-service/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | sping-cloud-learn
7 | com.cloud
8 | 1.0-SNAPSHOT
9 |
10 | 4.0.0
11 |
12 | com.cloud
13 | cloud-service
14 | 1.0-SNAPSHOT
15 | jar
16 |
17 |
18 |
19 | org.springframework.cloud
20 | spring-cloud-starter-netflix-eureka-client
21 |
22 |
23 | org.springframework.boot
24 | spring-boot-starter-web
25 |
26 |
27 |
28 |
29 |
30 |
31 | org.springframework.boot
32 | spring-boot-maven-plugin
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-service2/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | sping-cloud-learn
7 | com.cloud
8 | 1.0-SNAPSHOT
9 |
10 | 4.0.0
11 |
12 | com.cloud
13 | cloud-service2
14 | 1.0-SNAPSHOT
15 | jar
16 |
17 |
18 |
19 | org.springframework.cloud
20 | spring-cloud-starter-netflix-eureka-client
21 |
22 |
23 | org.springframework.boot
24 | spring-boot-starter-web
25 |
26 |
27 |
28 |
29 |
30 |
31 | org.springframework.boot
32 | spring-boot-maven-plugin
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-consumer/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | sping-cloud-learn
7 | com.cloud
8 | 1.0-SNAPSHOT
9 |
10 | 4.0.0
11 |
12 | com.cloud
13 | cloud-consumer
14 | 1.0-SNAPSHOT
15 | jar
16 |
17 |
18 |
19 | org.springframework.cloud
20 | spring-cloud-starter-netflix-eureka-client
21 |
22 |
23 | org.springframework.boot
24 | spring-boot-starter-web
25 |
26 |
27 | org.springframework.cloud
28 | spring-cloud-starter-netflix-ribbon
29 |
30 |
31 | org.springframework.cloud
32 | spring-cloud-starter-netflix-hystrix
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-config/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | sping-cloud-learn
7 | com.cloud
8 | 1.0-SNAPSHOT
9 |
10 | 4.0.0
11 |
12 | com.cloud
13 | cloud-config
14 | 1.0-SNAPSHOT
15 | jar
16 |
17 |
18 |
19 | org.springframework.boot
20 | spring-boot-starter-web
21 |
22 |
23 | org.springframework.cloud
24 | spring-cloud-config-server
25 |
26 |
27 | org.springframework.cloud
28 | spring-cloud-starter-netflix-eureka-client
29 |
30 |
31 |
32 |
33 |
34 | org.springframework.boot
35 | spring-boot-maven-plugin
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-gateway/src/main/java/com/cloud/gateway/GatewayApplication.java:
--------------------------------------------------------------------------------
1 | package com.cloud.gateway;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.cloud.gateway.route.RouteLocator;
6 | import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
7 | import org.springframework.context.annotation.Bean;
8 | import org.springframework.web.bind.annotation.RequestMapping;
9 | import org.springframework.web.bind.annotation.RestController;
10 | import reactor.core.publisher.Mono;
11 |
12 | /**
13 | * Created by wei.li
14 | * on 2019/3/4
15 | */
16 |
17 | @SpringBootApplication
18 | @RestController
19 | public class GatewayApplication {
20 |
21 |
22 | public static void main(String[] args) {
23 | SpringApplication.run(GatewayApplication.class, args);
24 | }
25 |
26 | /* @Bean
27 | public RouteLocator routes(RouteLocatorBuilder builder){
28 | return builder.routes()
29 | .route(p -> p.
30 | path("/hello").
31 | filters(f -> f.addRequestHeader("hello", "word"))
32 | .uri("http://localhost:8085"))
33 | .route(p -> p
34 | .path("/hello")
35 | .filters(f -> f
36 | .hystrix(config -> config
37 | .setName("mycmd")
38 | .setFallbackUri("forward:/fallback")))
39 | .uri("http://localhost:8085"))
40 | .build();
41 | }
42 |
43 |
44 | @RequestMapping("/fallback")
45 | public Mono fallback(){
46 | return Mono.just("fallback");
47 | }*/
48 | }
49 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-config-client/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | sping-cloud-learn
7 | com.cloud
8 | 1.0-SNAPSHOT
9 |
10 | 4.0.0
11 |
12 | com.cloud
13 | cloud-config-client
14 | 1.0-SNAPSHOT
15 | jar
16 |
17 |
18 |
19 | org.springframework.boot
20 | spring-boot-starter-web
21 |
22 |
23 | org.springframework.cloud
24 | spring-cloud-starter-config
25 |
26 |
27 | org.springframework.cloud
28 | spring-cloud-starter-netflix-eureka-client
29 |
30 |
31 | org.springframework.cloud
32 | spring-cloud-starter-bus-amqp
33 |
34 |
35 | org.springframework.boot
36 | spring-boot-starter-actuator
37 |
38 |
39 |
40 |
41 |
42 |
43 | org.springframework.boot
44 | spring-boot-maven-plugin
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-gateway/target/classes/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8080
3 |
4 | spring:
5 | cloud:
6 | gateway:
7 | routes:
8 | - id: after_route
9 | uri: http://localhost:8085/hello
10 | predicates:
11 | - After=2018-04-20T17:42:47.789-07:00[America/Denver]
12 |
13 | spring:
14 | cloud:
15 | gateway:
16 | routes:
17 | - id: before_route
18 | uri: http://localhost:8085/hello
19 | predicates:
20 | - Before=2018-04-20T17:42:47.789-07:00[America/Denver
21 |
22 | spring:
23 | cloud:
24 | gateway:
25 | routes:
26 | - id: between_route
27 | uri: http://localhost:8085/hello
28 | predicates:
29 | - Between=2018-04-20T17:42:47.789-07:00[America/Denver],2019-04-20T17:42:47.789-07:00[America/Denver]
30 |
31 | spring:
32 | cloud:
33 | gateway:
34 | routes:
35 | - id: cookie_route
36 | uri: http://localhost:8085/hello
37 | predicates:
38 | - Cookie=name,test
39 |
40 | spring:
41 | cloud:
42 | gateway:
43 | routes:
44 | - id: header_route
45 | uri: http://localhost:8085/hello
46 | predicates:
47 | - Header=X-Request-Id,\d+
48 |
49 | spring:
50 | cloud:
51 | gateway:
52 | routes:
53 | - id: host_route
54 | uri: http://localhost:8085/hello
55 | predicates:
56 | - Host=**.baidu.org
57 |
58 | spring:
59 | cloud:
60 | gateway:
61 | routes:
62 | - id: method_route
63 | uri: http://localhost:8085/hello
64 | predicates:
65 | - Method=GET
66 |
67 | spring:
68 | cloud:
69 | gateway:
70 | routes:
71 | - id: path_route
72 | uri: http://localhost:8085/hello
73 | predicates:
74 | - Path=/test/{name}
75 |
76 | spring:
77 | cloud:
78 | gateway:
79 | routes:
80 | - id: query_route
81 | uri: http://localhost:8085/hello
82 | predicates:
83 | - Query=name,test.
84 |
85 | spring:
86 | cloud:
87 | gateway:
88 | routes:
89 | - id: remoteaddr_route
90 | uri: http://localhost:8085/hello
91 | predicates:
92 | - RemoteAddr=192.168.1.1
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-gateway/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8080
3 |
4 | spring:
5 | cloud:
6 | gateway:
7 | routes:
8 | - id: after_route
9 | uri: http://localhost:8085/hello
10 | predicates:
11 | - After=2018-04-20T17:42:47.789-07:00[America/Denver]
12 |
13 | spring:
14 | cloud:
15 | gateway:
16 | routes:
17 | - id: before_route
18 | uri: http://localhost:8085/hello
19 | predicates:
20 | - Before=2018-04-20T17:42:47.789-07:00[America/Denver
21 |
22 | spring:
23 | cloud:
24 | gateway:
25 | routes:
26 | - id: between_route
27 | uri: http://localhost:8085/hello
28 | predicates:
29 | - Between=2018-04-20T17:42:47.789-07:00[America/Denver],2019-04-20T17:42:47.789-07:00[America/Denver]
30 |
31 | spring:
32 | cloud:
33 | gateway:
34 | routes:
35 | - id: cookie_route
36 | uri: http://localhost:8085/hello
37 | predicates:
38 | - Cookie=name,test
39 |
40 | spring:
41 | cloud:
42 | gateway:
43 | routes:
44 | - id: header_route
45 | uri: http://localhost:8085/hello
46 | predicates:
47 | - Header=X-Request-Id,\d+
48 |
49 | spring:
50 | cloud:
51 | gateway:
52 | routes:
53 | - id: host_route
54 | uri: http://localhost:8085/hello
55 | predicates:
56 | - Host=**.baidu.org
57 |
58 | spring:
59 | cloud:
60 | gateway:
61 | routes:
62 | - id: method_route
63 | uri: http://localhost:8085/hello
64 | predicates:
65 | - Method=GET
66 |
67 | spring:
68 | cloud:
69 | gateway:
70 | routes:
71 | - id: path_route
72 | uri: http://localhost:8085/hello
73 | predicates:
74 | - Path=/test/{name}
75 |
76 | spring:
77 | cloud:
78 | gateway:
79 | routes:
80 | - id: query_route
81 | uri: http://localhost:8085/hello
82 | predicates:
83 | - Query=name,test.
84 |
85 | spring:
86 | cloud:
87 | gateway:
88 | routes:
89 | - id: remoteaddr_route
90 | uri: http://localhost:8085/hello
91 | predicates:
92 | - RemoteAddr=192.168.1.1
--------------------------------------------------------------------------------
/spring-cloud-learn/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | com.cloud
8 | sping-cloud-learn
9 | 1.0-SNAPSHOT
10 | pom
11 |
12 |
13 | cloud-eureka
14 | cloud-service
15 | cloud-consumer
16 | cloud-consumer-feign
17 | cloud-zuul
18 | cloud-service2
19 | cloud-config
20 | cloud-config-client
21 | cloud-gateway
22 | cloud-predict
23 |
24 |
25 |
26 | org.springframework.boot
27 | spring-boot-starter-parent
28 | 2.0.5.RELEASE
29 |
30 |
31 |
32 | UTF-8
33 | UTF-8
34 | 1.8
35 | Finchley.RELEASE
36 |
37 |
38 |
39 |
40 | org.springframework.boot
41 | spring-boot-starter-test
42 | test
43 |
44 |
45 |
46 |
47 |
48 |
49 | org.springframework.cloud
50 | spring-cloud-dependencies
51 | ${spring-cloud.version}
52 | pom
53 | import
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 | org.springframework.boot
62 | spring-boot-maven-plugin
63 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/spring-cloud-learn/sping-cloud-learn.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-gateway/cloud-gateway.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-predict/cloud-predict.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-service/cloud-service.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-service2/cloud-service2.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-consumer-feign/cloud-consumer-feign.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-consumer/cloud-consumer.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-config/cloud-config.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-eureka/cloud-eureka.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-zuul/cloud-zuul.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
--------------------------------------------------------------------------------
/spring-cloud-learn/cloud-config-client/cloud-config-client.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
--------------------------------------------------------------------------------