1.Spring Cloud简介
Spring Cloud是一系列框架的有序集合。它利用Spring Boot的开发便利性巧妙地简化了分布式系统基础设施的开发,如服务发现注册、配置中心、消息总线、负载均衡、断路器、数据监控等,都可以用Spring Boot的开发风格做到一键启动和部署。Spring Cloud并没有重复制造轮子,它只是将目前各家公司开发的比较成熟、经得起实际考验的服务框架组合起来,通过Spring Boot风格进行再封装屏蔽掉了复杂的配置和实现原理,最终给开发者留出了一套简单易懂、易部署和易维护的分布式系统开发工具包。
2.基本的服务者与消费者及调用关系
1 import org.springframework.context.annotation.Bean; 2 import org.springframework.context.annotation.Configuration; 3 import org.springframework.web.client.RestTemplate; 4 5 /** 6 * SpringCloud相关配置 7 * @author Administrator 8 * 9 */ 10 @Configuration 11 public class SpringCloudConfig { 12 13 /** 14 * 调用服务模版 15 * @return 16 */ 17 @Bean 18 public RestTemplate getRestTemplate(){ 19 return new RestTemplate(); 20 } 21 }