├── doc └── Eureka集群.jpeg ├── springcloud-eureka-cluster ├── springcloud-eureka-cluster-client-provider │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ └── application.yml │ │ │ └── java │ │ │ └── org │ │ │ └── spring │ │ │ └── springcloud │ │ │ ├── ProviderApplication.java │ │ │ └── web │ │ │ └── ProviderController.java │ └── pom.xml ├── springcloud-eureka-cluster-client-customer │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ └── application.yml │ │ │ └── java │ │ │ └── org │ │ │ └── spring │ │ │ └── springcloud │ │ │ ├── CustomerApplication.java │ │ │ └── web │ │ │ └── CustomerController.java │ └── pom.xml ├── springcloud-eureka-cluster-server │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ ├── application-cluster8888.yml │ │ │ └── application-cluster8889.yml │ │ │ └── java │ │ │ └── org │ │ │ └── spring │ │ │ └── springcloud │ │ │ └── EurekaServerApplication.java │ └── pom.xml └── pom.xml ├── springcloud-eureka-sample ├── springcloud-eureka-client-customer │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ └── application.yml │ │ │ └── java │ │ │ └── org │ │ │ └── spring │ │ │ └── springcloud │ │ │ ├── CustomerApplication.java │ │ │ └── web │ │ │ └── CustomerController.java │ └── pom.xml ├── springcloud-eureka-client-provider │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ └── application.yml │ │ │ └── java │ │ │ └── org │ │ │ └── spring │ │ │ └── springcloud │ │ │ ├── ProviderApplication.java │ │ │ └── web │ │ │ └── ProviderController.java │ └── pom.xml ├── springcloud-eureka-server │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ └── application.yml │ │ │ └── java │ │ │ └── org │ │ │ └── spring │ │ │ └── springcloud │ │ │ └── EurekaServerApplication.java │ └── pom.xml └── pom.xml ├── pom.xml └── README.md /doc/Eureka集群.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpringForAll/springcloud-learning-example/HEAD/doc/Eureka集群.jpeg -------------------------------------------------------------------------------- /springcloud-eureka-cluster/springcloud-eureka-cluster-client-provider/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | eureka: 2 | client: 3 | service-url: 4 | defaultZone: http://hostA:8888/eureka/,http://hostB:8889/eureka/ 5 | 6 | spring: 7 | application: 8 | name: cluster-provider-service -------------------------------------------------------------------------------- /springcloud-eureka-cluster/springcloud-eureka-cluster-client-customer/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8083 3 | 4 | eureka: 5 | client: 6 | service-url: 7 | defaultZone: http://localhost:8888/eureka/ 8 | 9 | spring: 10 | application: 11 | name: cluster-customer-service -------------------------------------------------------------------------------- /springcloud-eureka-sample/springcloud-eureka-client-customer/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8081 # 服务端口 3 | 4 | eureka: 5 | client: 6 | service-url: 7 | defaultZone: http://localhost:8888/eureka/ # 服务注册中心地址 8 | 9 | spring: 10 | application: 11 | name: customer-service # 服务名称 -------------------------------------------------------------------------------- /springcloud-eureka-sample/springcloud-eureka-client-provider/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 # 服务端口 3 | 4 | eureka: 5 | client: 6 | service-url: 7 | defaultZone: http://localhost:8888/eureka/ # 服务注册中心地址 8 | 9 | spring: 10 | application: 11 | name: provider-service # 服务名称 -------------------------------------------------------------------------------- /springcloud-eureka-cluster/springcloud-eureka-cluster-server/src/main/resources/application-cluster8888.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8888 3 | 4 | eureka: 5 | instance: 6 | hostname: hostA # 设置主机名 7 | client: 8 | service-url: 9 | defaultZone: http://hostB:8889/eureka/ 10 | 11 | spring: 12 | application: 13 | name: eureka-cluster-server -------------------------------------------------------------------------------- /springcloud-eureka-cluster/springcloud-eureka-cluster-server/src/main/resources/application-cluster8889.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8889 3 | 4 | eureka: 5 | instance: 6 | hostname: hostB # 设置主机名 7 | client: 8 | service-url: 9 | defaultZone: http://hostA:8888/eureka/ 10 | 11 | spring: 12 | application: 13 | name: eureka-cluster-server -------------------------------------------------------------------------------- /springcloud-eureka-sample/springcloud-eureka-server/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8888 # 服务端口 3 | 4 | eureka: 5 | instance: 6 | hostname: localhost # 设置主机名 7 | client: 8 | registerWithEureka: false # 是否向 Eureka 注册服务。该应用为服务注册中心,不需要自注册,设置为 false 9 | fetchRegistry: false # 是否检索服务。该应用为服务注册中心,职责为注册和发现服务,无需检索服务,设置为 false 10 | server: 11 | waitTimeInMsWhenSyncEmpty: 0 # 设置同步为空时的等待时间。默认 5 * MINUTES -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | springcloud :: Examples 5 | 6 | springcloud 7 | springcloud 8 | 1.0-SNAPSHOT 9 | pom 10 | 11 | 12 | 13 | 14 | springcloud-eureka-sample 15 | 16 | springcloud-eureka-cluster 17 | 18 | 19 | -------------------------------------------------------------------------------- /springcloud-eureka-sample/springcloud-eureka-client-provider/src/main/java/org/spring/springcloud/ProviderApplication.java: -------------------------------------------------------------------------------- 1 | package org.spring.springcloud; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cloud.netflix.eureka.EnableEurekaClient; 6 | 7 | /** 8 | * Spring Boot Eureka Server 应用启动类 9 | * 10 | * Created by bysocket on 21/06/17. 11 | */ 12 | @EnableEurekaClient // Eureka Client 标识 13 | @SpringBootApplication // Spring Boot 应用标识 14 | public class ProviderApplication { 15 | 16 | public static void main(String[] args) { 17 | // 程序启动入口 18 | // 启动嵌入式的 Tomcat 并初始化 Spring 环境及其各 Spring 组件 19 | SpringApplication.run(ProviderApplication.class,args); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /springcloud-eureka-sample/springcloud-eureka-server/src/main/java/org/spring/springcloud/EurekaServerApplication.java: -------------------------------------------------------------------------------- 1 | package org.spring.springcloud; 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 | * Spring Boot Eureka Server 应用启动类 9 | * 10 | * Created by bysocket on 21/06/17. 11 | */ 12 | @EnableEurekaServer // Eureka Server 标识 13 | @SpringBootApplication // Spring Boot 应用标识 14 | public class EurekaServerApplication { 15 | 16 | public static void main(String[] args) { 17 | // 程序启动入口 18 | // 启动嵌入式的 Tomcat 并初始化 Spring 环境及其各 Spring 组件 19 | SpringApplication.run(EurekaServerApplication.class,args); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /springcloud-eureka-cluster/springcloud-eureka-cluster-client-provider/src/main/java/org/spring/springcloud/ProviderApplication.java: -------------------------------------------------------------------------------- 1 | package org.spring.springcloud; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cloud.netflix.eureka.EnableEurekaClient; 6 | 7 | /** 8 | * Spring Boot Eureka Server 应用启动类 9 | * 10 | * Created by bysocket on 21/06/17. 11 | */ 12 | @EnableEurekaClient // Eureka Client 标识 13 | @SpringBootApplication // Spring Boot 应用标识 14 | public class 15 | 16 | 17 | ProviderApplication { 18 | 19 | public static void main(String[] args) { 20 | // 程序启动入口 21 | // 启动嵌入式的 Tomcat 并初始化 Spring 环境及其各 Spring 组件 22 | SpringApplication.run(ProviderApplication.class,args); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /springcloud-eureka-sample/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | springcloud :: Eureka Sample 5 | 6 | springcloud 7 | springcloud-eureka-sample 8 | 1.0-SNAPSHOT 9 | pom 10 | 11 | 12 | 13 | 14 | springcloud-eureka-server 15 | 16 | springcloud-eureka-client-provider 17 | 18 | springcloud-eureka-client-customer 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /springcloud-eureka-cluster/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | springcloud :: Eureka Cluster 5 | 6 | springcloud 7 | springcloud-eureka-cluster 8 | 1.0-SNAPSHOT 9 | pom 10 | 11 | 12 | 13 | 14 | springcloud-eureka-cluster-server 15 | 16 | springcloud-eureka-cluster-client-provider 17 | 18 | springcloud-eureka-cluster-client-customer 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /springcloud-eureka-cluster/springcloud-eureka-cluster-server/src/main/java/org/spring/springcloud/EurekaServerApplication.java: -------------------------------------------------------------------------------- 1 | package org.spring.springcloud; 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.cloud.netflix.eureka.server.EnableEurekaServer; 7 | 8 | /** 9 | * Spring Boot Eureka Server 应用启动类 10 | * 11 | * Created by bysocket on 21/06/17. 12 | */ 13 | @EnableEurekaServer // Eureka Server 标识 14 | @EnableEurekaClient 15 | @SpringBootApplication // Spring Boot 应用标识 16 | public class EurekaServerApplication { 17 | 18 | public static void main(String[] args) { 19 | // 程序启动入口 20 | // 启动嵌入式的 Tomcat 并初始化 Spring 环境及其各 Spring 组件 21 | SpringApplication.run(EurekaServerApplication.class,args); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /springcloud-eureka-sample/springcloud-eureka-client-customer/src/main/java/org/spring/springcloud/CustomerApplication.java: -------------------------------------------------------------------------------- 1 | package org.spring.springcloud; 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.context.annotation.Bean; 8 | import org.springframework.web.client.RestTemplate; 9 | 10 | /** 11 | * Spring Boot Eureka Server 应用启动类 12 | * 13 | * Created by bysocket on 21/06/17. 14 | */ 15 | @EnableDiscoveryClient // Eureka Discovery Client 标识 16 | @SpringBootApplication // Spring Boot 应用标识 17 | public class CustomerApplication { 18 | 19 | @Bean 20 | @LoadBalanced 21 | RestTemplate restTemplate() { 22 | return new RestTemplate(); 23 | } 24 | 25 | public static void main(String[] args) { 26 | // 程序启动入口 27 | // 启动嵌入式的 Tomcat 并初始化 Spring 环境及其各 Spring 组件 28 | SpringApplication.run(CustomerApplication.class,args); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /springcloud-eureka-sample/springcloud-eureka-client-customer/src/main/java/org/spring/springcloud/web/CustomerController.java: -------------------------------------------------------------------------------- 1 | package org.spring.springcloud.web; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.web.bind.annotation.RequestMapping; 7 | import org.springframework.web.bind.annotation.RestController; 8 | import org.springframework.web.client.RestTemplate; 9 | 10 | /** 11 | * Customer HelloWorld 案例 12 | *

13 | * Created by bysocket on 06/22/17. 14 | */ 15 | @RestController 16 | public class CustomerController { 17 | 18 | private static final Logger LOGGER = LoggerFactory.getLogger(CustomerController.class); 19 | 20 | @Autowired 21 | private RestTemplate restTemplate; // HTTP 访问操作类 22 | 23 | @RequestMapping("/customer") 24 | public String customer() { 25 | String providerMsg = restTemplate.getForEntity("http://PROVIDER-SERVICE/provider", 26 | String.class).getBody(); 27 | 28 | return "Hello,Customer! msg from provider :

" + providerMsg; 29 | } 30 | } -------------------------------------------------------------------------------- /springcloud-eureka-cluster/springcloud-eureka-cluster-client-customer/src/main/java/org/spring/springcloud/CustomerApplication.java: -------------------------------------------------------------------------------- 1 | package org.spring.springcloud; 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.context.annotation.Bean; 8 | import org.springframework.web.client.RestTemplate; 9 | 10 | /** 11 | * Spring Boot Eureka Server 应用启动类 12 | * 13 | * Created by bysocket on 21/06/17. 14 | */ 15 | @EnableDiscoveryClient // Eureka Discovery Client 标识 16 | @SpringBootApplication // Spring Boot 应用标识 17 | public class CustomerApplication { 18 | 19 | @Bean 20 | @LoadBalanced 21 | RestTemplate restTemplate() { 22 | return new RestTemplate(); 23 | } 24 | 25 | public static void main(String[] args) { 26 | // 程序启动入口 27 | // 启动嵌入式的 Tomcat 并初始化 Spring 环境及其各 Spring 组件 28 | SpringApplication.run(CustomerApplication.class,args); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /springcloud-eureka-cluster/springcloud-eureka-cluster-client-customer/src/main/java/org/spring/springcloud/web/CustomerController.java: -------------------------------------------------------------------------------- 1 | package org.spring.springcloud.web; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.web.bind.annotation.RequestMapping; 7 | import org.springframework.web.bind.annotation.RestController; 8 | import org.springframework.web.client.RestTemplate; 9 | 10 | /** 11 | * Customer HelloWorld 案例 12 | *

13 | * Created by bysocket on 06/22/17. 14 | */ 15 | @RestController 16 | public class CustomerController { 17 | 18 | private static final Logger LOGGER = LoggerFactory.getLogger(CustomerController.class); 19 | 20 | @Autowired 21 | private RestTemplate restTemplate; // HTTP 访问操作类 22 | 23 | @RequestMapping("/customer") 24 | public String customer() { 25 | String providerMsg = restTemplate.getForEntity("http://CLUSTER-PROVIDER-SERVICE/provider", 26 | String.class).getBody(); 27 | 28 | return "Hello,Customer! msg from provider :

" + providerMsg; 29 | } 30 | 31 | } -------------------------------------------------------------------------------- /springcloud-eureka-cluster/springcloud-eureka-cluster-client-provider/src/main/java/org/spring/springcloud/web/ProviderController.java: -------------------------------------------------------------------------------- 1 | package org.spring.springcloud.web; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.cloud.client.ServiceInstance; 7 | import org.springframework.cloud.client.discovery.DiscoveryClient; 8 | import org.springframework.cloud.client.serviceregistry.Registration; 9 | import org.springframework.web.bind.annotation.RequestMapping; 10 | import org.springframework.web.bind.annotation.RestController; 11 | 12 | import java.util.List; 13 | 14 | /** 15 | * Provider HelloWorld 案例 16 | *

17 | * Created by bysocket on 06/22/17. 18 | */ 19 | @RestController 20 | public class ProviderController { 21 | 22 | private static final Logger LOGGER = LoggerFactory.getLogger(ProviderController.class); 23 | 24 | @Autowired 25 | private DiscoveryClient discoveryClient; 26 | 27 | @Autowired 28 | private Registration registration; 29 | 30 | @RequestMapping("/provider") 31 | public String provider() { 32 | ServiceInstance instance = serviceInstance(); 33 | LOGGER.info("provider service, host = " + instance.getHost() 34 | + ", service_id = " + instance.getServiceId()); 35 | return "Hello,Provider!"; 36 | } 37 | 38 | public ServiceInstance serviceInstance() { 39 | List list = discoveryClient.getInstances(registration.getServiceId()); 40 | if (list != null && list.size() > 0) { 41 | return list.get(0); 42 | } 43 | return null; 44 | } 45 | } -------------------------------------------------------------------------------- /springcloud-eureka-sample/springcloud-eureka-client-provider/src/main/java/org/spring/springcloud/web/ProviderController.java: -------------------------------------------------------------------------------- 1 | package org.spring.springcloud.web; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.cloud.client.ServiceInstance; 7 | import org.springframework.cloud.client.discovery.DiscoveryClient; 8 | import org.springframework.cloud.client.serviceregistry.Registration; 9 | import org.springframework.web.bind.annotation.RequestMapping; 10 | import org.springframework.web.bind.annotation.RestController; 11 | 12 | import java.util.List; 13 | 14 | /** 15 | * Provider HelloWorld 案例 16 | *

17 | * Created by bysocket on 06/22/17. 18 | */ 19 | @RestController 20 | public class ProviderController { 21 | 22 | private static final Logger LOGGER = LoggerFactory.getLogger(ProviderController.class); 23 | 24 | @Autowired 25 | private Registration registration; // 服务注册 26 | 27 | @Autowired 28 | private DiscoveryClient discoveryClient; // 服务发现客户端 29 | 30 | @RequestMapping("/provider") 31 | public String provider() { 32 | ServiceInstance instance = serviceInstance(); 33 | LOGGER.info("provider service, host = " + instance.getHost() 34 | + ", service_id = " + instance.getServiceId()); 35 | return "Hello,Provider!"; 36 | } 37 | 38 | /** 39 | * 获取当前服务的服务实例 40 | * 41 | * @return ServiceInstance 42 | */ 43 | public ServiceInstance serviceInstance() { 44 | List list = discoveryClient.getInstances(registration.getServiceId()); 45 | if (list != null && list.size() > 0) { 46 | return list.get(0); 47 | } 48 | return null; 49 | } 50 | } -------------------------------------------------------------------------------- /springcloud-eureka-cluster/springcloud-eureka-cluster-server/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | springcloud 7 | springcloud-eureka-cluster-server 8 | 0.0.1-SNAPSHOT 9 | springcloud-eureka-cluster-server :: Spring Cloud Eureka 服务注册中心集群 10 | 11 | 12 | 13 | org.springframework.boot 14 | spring-boot-starter-parent 15 | 1.5.4.RELEASE 16 | 17 | 18 | 19 | 20 | 21 | org.springframework.cloud 22 | spring-cloud-starter-eureka-server 23 | 24 | 25 | 26 | 27 | org.springframework.boot 28 | spring-boot-starter-test 29 | test 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | org.springframework.cloud 38 | spring-cloud-netflix 39 | 1.3.1.RELEASE 40 | pom 41 | import 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | org.springframework.boot 50 | spring-boot-maven-plugin 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /springcloud-eureka-sample/springcloud-eureka-client-customer/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | springcloud 7 | springcloud-eureka-client-customer 8 | 0.0.1-SNAPSHOT 9 | springcloud-eureka-client-customer :: 服务消费者 10 | 11 | 12 | 13 | org.springframework.boot 14 | spring-boot-starter-parent 15 | 1.5.4.RELEASE 16 | 17 | 18 | 19 | 20 | 21 | org.springframework.cloud 22 | spring-cloud-starter-eureka 23 | 24 | 25 | 26 | 27 | org.springframework.boot 28 | spring-boot-starter-test 29 | test 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | org.springframework.cloud 38 | spring-cloud-netflix 39 | 1.3.1.RELEASE 40 | pom 41 | import 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | org.apache.maven.plugins 50 | maven-compiler-plugin 51 | 52 | 1.8 53 | 1.8 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /springcloud-eureka-sample/springcloud-eureka-client-provider/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | springcloud 7 | springcloud-eureka-client-provider 8 | 0.0.1-SNAPSHOT 9 | springcloud-eureka-client-provider :: 服务提供者 10 | 11 | 12 | 13 | org.springframework.boot 14 | spring-boot-starter-parent 15 | 1.5.4.RELEASE 16 | 17 | 18 | 19 | 20 | 21 | org.springframework.cloud 22 | spring-cloud-starter-eureka 23 | 24 | 25 | 26 | 27 | org.springframework.boot 28 | spring-boot-starter-test 29 | test 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | org.springframework.cloud 38 | spring-cloud-netflix 39 | 1.3.1.RELEASE 40 | pom 41 | import 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | org.apache.maven.plugins 50 | maven-compiler-plugin 51 | 52 | 1.8 53 | 1.8 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /springcloud-eureka-sample/springcloud-eureka-server/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | springcloud 7 | springcloud-eureka-server 8 | 0.0.1-SNAPSHOT 9 | springcloud-eureka-server :: Spring Cloud Eureka 服务注册中心 10 | 11 | 12 | 13 | org.springframework.boot 14 | spring-boot-starter-parent 15 | 1.5.4.RELEASE 16 | 17 | 18 | 19 | 20 | 21 | org.springframework.cloud 22 | spring-cloud-starter-eureka-server 23 | 24 | 25 | 26 | 27 | org.springframework.boot 28 | spring-boot-starter-test 29 | test 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | org.springframework.cloud 38 | spring-cloud-netflix 39 | 1.3.1.RELEASE 40 | pom 41 | import 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | org.apache.maven.plugins 50 | maven-compiler-plugin 51 | 52 | 1.8 53 | 1.8 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /springcloud-eureka-cluster/springcloud-eureka-cluster-client-provider/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | springcloud 7 | springcloud-eureka-cluster-client-provider 8 | 0.0.1-SNAPSHOT 9 | springcloud-eureka-cluster-client-provider :: 服务提供者集群 10 | 11 | 12 | 13 | org.springframework.boot 14 | spring-boot-starter-parent 15 | 1.5.4.RELEASE 16 | 17 | 18 | 19 | 20 | 21 | org.springframework.cloud 22 | spring-cloud-starter-eureka 23 | 24 | 25 | 26 | 27 | org.springframework.boot 28 | spring-boot-starter-test 29 | test 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | org.springframework.cloud 38 | spring-cloud-netflix 39 | 1.3.1.RELEASE 40 | pom 41 | import 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | org.springframework.boot 50 | spring-boot-maven-plugin 51 | 52 | 53 | 54 | org.apache.maven.plugins 55 | maven-compiler-plugin 56 | 57 | 1.8 58 | 1.8 59 | 60 | 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /springcloud-eureka-cluster/springcloud-eureka-cluster-client-customer/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | springcloud 7 | springcloud-eureka-cluster-client-customer 8 | 0.0.1-SNAPSHOT 9 | springcloud-eureka-cluster-client-customer :: 服务消费者集群 10 | 11 | 12 | 13 | org.springframework.boot 14 | spring-boot-starter-parent 15 | 1.5.4.RELEASE 16 | 17 | 18 | 19 | 20 | 21 | org.springframework.cloud 22 | spring-cloud-starter-eureka 23 | 24 | 25 | 26 | 27 | org.springframework.boot 28 | spring-boot-starter-test 29 | test 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | org.springframework.cloud 38 | spring-cloud-netflix 39 | 1.3.1.RELEASE 40 | pom 41 | import 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | org.springframework.boot 51 | spring-boot-maven-plugin 52 | 53 | 54 | 55 | org.apache.maven.plugins 56 | maven-compiler-plugin 57 | 58 | 1.8 59 | 1.8 60 | 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # springcloud-learning-example 2 | spring boot 实践学习案例,是 spring boot 初学者及核心技术巩固的最佳实践。 3 | 4 | ## Spring For All 社区 5 | [Spring For All 社区](http://www.spring4all.com/ "spring4all")是新组建的关于 Spring 的纯技术交流社区(涵盖 Spring Boot、Spring Cloud 等内容),集诸多开源爱好者和技术大牛贡献内容和交流问题。我们不夸大、不装逼、做最纯粹的技术分享!!! 6 | 7 | 看看我们超强的群众基础,欢迎有兴趣的朋友加入QQ群分享与交流: 8 | 9 | Spring For All 社区 ① 365234583(满)
10 | Spring For All 社区 ② 123013854(满)
11 | Spring For All 社区 ③ 290714704(满)
12 | Spring For All 社区 ④ 112133511(满)
13 | Spring For All 社区 ⑤ 157525002(满)
14 | Spring For All 社区 ⑥ 564840207
15 | Spring For All 社区 ⑦ 470962790(满)
16 | Spring For All 社区 ⑧ 613456104(满)
17 | Spring For All 社区 ⑨ 534583667
18 | Spring For All 社区 ⑩ 210742970 (满)
19 | Spring For All 社区 ⑪ 517395240
20 | Spring For All 社区 ⑫ 498098401
21 | 22 | 博主微信:139-5868-6678 23 | 24 | ## 作者与学习乐园 25 | 源码地址:我的[GitHub地址](https://github.com/JeffLi1993 "GitHub")、[OSCGit地址](https://git.oschina.net/jeff1993/springboot-learning-example "OSCGit")
26 | 作者:[泥瓦匠BYSocket](http://www.bysocket.com/ "泥瓦匠BYSocket")
27 | 关注微信公众号【泥瓦匠BYSokcet】,及时得到技术文章推送
28 | ![公众号](http://www.bysocket.com/wp-content/uploads/2017/01/qrcode_for_gh_cd421e7eb7d6_430.jpg) 29 | 30 | 31 | ## 一、项目结构 32 | 「Spring Cloud 那些事」:[传送门](http://www.bysocket.com/?p=1907)
33 | 34 | ### a. 『 Eureka 篇 』 35 | 36 | #### springcloud-eureka-sample (Spring Cloud 之 Eureka 入门案例) 37 | - springcloud-eureka-server (Spring Cloud Eureka 注册中心服务) 38 | - springcloud-eureka-client-provider (Spring Cloud 服务提供者) 39 | - springcloud-eureka-client-customer (Spring Cloud 服务消费者) 40 | 41 | 对应教程: 42 | - [《Spring Cloud Eureka 入门 (一)服务注册中心详解》](http://spring4all.com/article/101)
43 | - [《Spring Cloud Eureka 入门 (二)服务提供者详解》](http://spring4all.com/article/122)
44 | - [《Spring Cloud Eureka 入门 (三)服务消费者详解》](http://spring4all.com/article/131)
45 | 46 | - - - 47 | 48 | #### springcloud-eureka-cluster (Spring Cloud 之 Eureka cluster 集群案例) 49 | - springcloud-eureka-cluster-server (Spring Cloud Eureka 服务注册中心集群) 50 | - springcloud-eureka-cluster-client-provider (Spring Cloud 服务提供者集群) 51 | - springcloud-eureka-cluster-client-customer (Spring Cloud 服务消费者集群) 52 | 53 | 对应教程: 54 | - [《Spring Cloud 之 Eureka 集群搭建(一)Eureka 注册中心服务集群》](http://spring4all.com/explore/category-springcloud)
55 | - [《Spring Cloud 之 Eureka 集群搭建(二)Eureka 服务提供者和消费者集群》](http://spring4all.com/explore/category-springcloud)
56 | 57 | 58 | ## 二、项目 Quick Start 快速开发指南 59 | 60 | 推荐 61 | [《Spring Boot教程与Spring Cloud教程》](https://git.oschina.net/didispace/SpringBoot-Learning "Spring Boot教程与Spring Cloud教程")
62 | --------------------------------------------------------------------------------