Spring Cloud Development in Practice cover

Spring Cloud Development in Practice

Rating 3.5
Word count
81K words
Chapters
373
ISBN
9787121411182

Tags

Summary

This book is an introductory tutorial to Spring Cloud development and a hands-on programming guide. As Spring Cloud has grown increasingly popular over the past two years, mastering Spring Cloud development skills will greatly benefit programmers, programming instructors, enthusiasts, and students alike.

The book is divided into 15 chapters that provide a comprehensive explanation of various Spring Cloud components, with targeted comparisons of alternative products for specific components. These include Spring Cloud registry centers Eureka and Consul; gateway components Zuul and Gateway; asynchronous message queue Kafka; and configuration center Config. The chapters are concise and to the point, aiming to explain the entire Spring Cloud technology system with the most concise text and code, so that readers will benefit greatly from reading.

Editor's review

This book has a clear positioning: it is a hands-on, practice-oriented introductory tutorial to Spring Cloud. Across 15 chapters, the author unpacks core components one by one—Eureka and Consul for service registry, Zuul and Gateway for API gateway, Kafka for asynchronous messaging, and Config for centralized configuration—and, when introducing a given component, makes targeted comparisons with its alternatives. This is particularly helpful for beginners in building an awareness of technology selection. The book aims to explain the technical system clearly with concise prose and code; its chapter organization is straightforward, making it suitable as a desk reference to read and practice alongside. For practitioners new to microservices who need to connect scattered concepts into a complete development chain, this book offers a relatively gentle learning path; for those teaching courses or doing course design, it can also serve as a reference for organizing examples. One caveat: the content was written in 2021, so readers should cross-check component versions and configuration syntax against official documentation.

Who it's for

A good fit for

  • Programming practitioners with a Java foundation who are preparing to get started with microservice development
  • Development beginners who need a systematic understanding of common Spring Cloud components and technology selection
  • Instructors teaching Java or microservices courses, for organizing teaching examples
  • Students doing course design or graduation projects who need to build microservices hands-on

Not a good fit for

  • Readers with no Java or Spring foundation at all, who first need to build up the language basics
  • Senior developers seeking source-level principles and architectural governance
  • Readers who only want to look up the latest version APIs and are unwilling to write code

Reading tips

  1. First read through the early chapters to set up a service registry and basic services, then implement each component hands-on chapter by chapter.
  2. When you reach the component comparison sections, record the rationale for selection and check the differences in current versions against official documentation.
  3. Run each chapter's code yourself before moving on; when you hit an error, first check the configuration and dependency versions.
  4. After finishing, use a small multi-service example to connect registry, gateway, configuration, and messaging into a complete chain.

About the publisher

Publishing House of Electronics Industry China · Founded in 1982

The Publishing House of Electronics Industry is a comprehensive publisher distinguished by its focus on electronic information and related fields. Judging from the more than 3,000 titles in its catalogue, its publishing covers programming and design, artificial intelligence, computer science, finance and economics, photography, and social sciences, attending both to cutting-edge technology and to general readers. Representative titles include Factor Investing: Methods and Practice, x86 Assembly Language: From Real Mode to Protected Mode, The RISC-V Reader, Artificial Intelligence: Speech Recognition, Understanding and Practice, Phased Array Radar Technology, Radar Target Characteristics, and 100 Go Mistakes and How to Avoid Them, most of which centre on technical methods and engineering practice. Its authors include Shi Chuan, Li Zhong, Wang Xiaobo, David Patterson, Andrew Waterman, and Yu Zihao, among others from China and abroad. Owing to limited public information, no further publishing features are elaborated here.

Contents

  1. 版权信息
  2. 内容简介
  3. 前言
  4. 第1章 Spring Cloud微服务简介
  5. 1.1 单体应用架构
  6. 1.1.1 单体应用架构简介
  7. 1.1.2 单体应用架构的优势
  8. 1.1.3 单体应用架构的劣势
  9. 1.2 微服务架构
  10. 1.2.1 微服务架构简介
  11. 1.2.2 微服务的来源
  12. 1.2.3 微服务的优点
  13. 1.2.4 微服务的缺点
  14. 1.2.5 微服务架构的选择
  15. 1.3 Spring Cloud介绍
  16. 1.3.1 Spring Cloud的概念
  17. 1.3.2 Spring Cloud的组件
  18. 1.3.3 Spring Cloud版本介绍
  19. 1.3.4 Spring Boot简介
  20. 1.3.5 Spring Boot和Spring Cloud的关系
  21. 1.4 本章小结
  22. 第2章 微服务开发工具
  23. 2.1 IDEA基本配置
  24. 2.1.1 IDEA的安装
  25. 2.1.2 字体设置
  26. 2.1.3 自动编译开源
  27. 2.1.4 代码提示设置
  28. 2.1.5 Tab多行显示
  29. 2.1.6 去掉行尾空格
  30. 2.1.7 设置行号显示
  31. 2.1.8 项目文件编码
  32. 2.1.9 自动导入包
  33. 2.2 IDEA快捷键
  34. 2.2.1 快捷键函数收尾
  35. 2.2.2 去掉无效引用
  36. 2.2.3 打开最近使用的文件
  37. 2.2.4 快速搜索文件
  38. 2.2.5 快速查找方法
  39. 2.2.6 快速搜索目录
  40. 2.2.7 快速切换编辑框
  41. 2.2.8 查看层级关系
  42. 2.2.9 展开成员变量
  43. 2.2.10 方法参数类型提示
  44. 2.2.11 查看方法调用
  45. 2.2.12 同词编辑
  46. 2.3 代码相关技巧
  47. 2.3.1 打开最近的项目
  48. 2.3.2 本地代码历史
  49. 2.3.3 展示类成员变量
  50. 2.3.4 内存展示
  51. 2.3.5 查看项目结构
  52. 2.3.6 多线程断点调试
  53. 2.3.7 同步显示类
  54. 2.4 IDEA代码模板配置
  55. 2.4.1 代码模板定制
  56. 2.4.2 注释生成
  57. 2.4.3 生成Java类模板
  58. 2.5 IDEA插件介绍
  59. 2.5.1 阿里巴巴规范插件
  60. 2.5.2 stackoverflow搜索插件
  61. 2.5.3 Maven Helper
  62. 2.5.4 POJO to JSON插件
  63. 2.5.5 GsonFormat插件
  64. 2.5.6 Grep Console日志查询工具
  65. 2.5.7 Redis可视化工具
  66. 2.5.8 代码高亮工具
  67. 2.5.9 翻译插件
  68. 2.5.10 字符串标记JSON
  69. 2.6 本章小结
  70. 第3章 注册中心
  71. 3.1 Eureka客户端
  72. 3.1.1 Eureka客户端依赖
  73. 3.1.2 Eureka客户端文件配置
  74. 3.2 Eureka服务端
  75. 3.2.1 Eureka服务端组件依赖
  76. 3.2.2 Eureka服务端文件配置
  77. 3.2.3 Eureka服务端启动类
  78. 3.2.4 注册中心启动
  79. 3.3 Eureka常用配置
  80. 3.3.1 Eureka权限认证
  81. 3.3.2 Eureka健康检查
  82. 3.4 Consul注册中心
  83. 3.4.1 Consul安装和启动
  84. 3.4.2 Consul服务端依赖
  85. 3.4.3 Consul服务端文件配置
  86. 3.4.4 Consul服务端启动类
  87. 3.4.5 Consul客户端文件配置
  88. 3.4.6 Consul客户端业务逻辑
  89. 3.5 本章小结
  90. 第4章 Feign客户端
  91. 4.1 Feign实例
  92. 4.1.1 Feign项目结构
  93. 4.1.2 Feign客户端依赖
  94. 4.1.3 Feign客户端文件配置
  95. 4.1.4 Feign客户端启动类配置
  96. 4.1.5 Feign的配置方式
  97. 4.1.6 Spring两种类型的bean对象
  98. 4.1.7 Feign客户端接口定义
  99. 4.1.8 Feign服务端依赖
  100. 4.1.9 Feign服务端文件配置
  101. 4.1.10 Feign服务端启动类
  102. 4.1.11 Feign服务端控制器
  103. 4.1.12 Feign项目启动
  104. 4.2 Feign请求
  105. 4.2.1 Feign get请求
  106. 4.2.2 Feign post请求
  107. 4.2.3 Feign服务降级
  108. 4.3 Feign高级配置
  109. 4.3.1 Feign安全认证配置
  110. 4.3.2 Feign超时配置
  111. 4.3.3 Feign日志配置
  112. 4.3.4 Feign核心类
  113. 4.4 Feign整合Zipkin
  114. 4.4.1 项目结构
  115. 4.4.2 Zipkin服务端依赖
  116. 4.4.3 Zipkin客户端依赖
  117. 4.4.4 Zipkin客户端配置文件
  118. 4.5 Hystrix注册中心
  119. 4.5.1 Hystrix原理
  120. 4.5.2 Hystrix项目结构
  121. 4.5.3 Hystrix注册中心依赖
  122. 4.5.4 Hystrix文件配置
  123. 4.5.5 Hystrix相关参数配置
  124. 4.5.6 Hystrix隔离策略
  125. 4.5.7 Eureka启动
  126. 4.6 构建Hystrix服务端
  127. 4.6.1 Hystrix服务端组件依赖
  128. 4.6.2 Hystrix文件配置
  129. 4.6.3 Hystrix启动类
  130. 4.6.4 Eureka配置文件
  131. 4.7 构建Hystrix客户端
  132. 4.7.1 Hystrix客户端依赖
  133. 4.7.2 Hystrix客户端启动配置
  134. 4.7.3 Hystrix增加控制类
  135. 4.7.4 Hystrix回退支持
  136. 4.8 本章小结
  137. 第5章 Ribbon负载均衡器
  138. 5.1 Ribbon注册中心
  139. 5.1.1 Eureka实例
  140. 5.1.2 Ribbon服务端实例
  141. 5.1.3 Ribbon客户端实例
  142. 5.1.4 Ribbon负载均衡
  143. 5.2 Ribbon常用配置
  144. 5.2.1 Ribbon注册中心状态设置
  145. 5.2.2 Ribbon注册中心超时设置
  146. 5.2.3 Ribbon路由配置
  147. 5.3 本章小结
  148. 第6章 Config配置中心
  149. 6.1 Config服务端
  150. 6.2 Config客户端
  151. 6.2.1 Config客户端依赖
  152. 6.2.2 Config客户端文件配置
  153. 6.2.3 动态配置刷新
  154. 6.3 本章小结
  155. 第7章 第三方配置中心
  156. 7.1 Apollo简介
  157. 7.1.1 Apollo的结构
  158. 7.1.2 Apollo配置环境
  159. 7.1.3 Apollo数据库配置
  160. 7.1.4 Apollo配置中心启动
  161. 7.2 Apollo配置中心
  162. 7.2.1 Apollo创建配置
  163. 7.2.2 Apollo新增配置
  164. 7.2.3 Apollo发布配置
  165. 7.2.4 Apollo启动
  166. 7.3 Apollo集群
  167. 7.3.1 集群配置
  168. 7.3.2 管理员工具
  169. 7.3.3 Apollo实例
  170. 7.4 Nacos配置中心
  171. 7.4.1 Nacos的安装
  172. 7.4.2 项目结构
  173. 7.4.3 Nacos服务端依赖
  174. 7.4.4 Nacos服务端
  175. 7.4.5 Nacos配置管理
  176. 7.5 ZooKeeper配置中心
  177. 7.5.1 ZooKeeper简介
  178. 7.5.2 使用场景
  179. 7.5.3 节点监控
  180. 7.5.4 ZooKeeper领导者选举
  181. 7.5.5 Watcher机制
  182. 7.5.6 ZooKeeper部署
  183. 7.5.7 zkui登录页面
  184. 7.5.8 ZooKeeper实例
  185. 7.6 本章小结
  186. 第8章 Zuul网关
  187. 8.1 Zuul基础实例
  188. 8.1.1 Zuul的作用
  189. 8.1.2 Zuul依赖
  190. 8.1.3 Zuul文件配置
  191. 8.1.4 启动类配置
  192. 8.2 Zuul实例
  193. 8.2.1 创建Eureka注册中心
  194. 8.2.2 Eureka客户端依赖
  195. 8.2.3 Eureka客户端文件配置
  196. 8.3 Zuul高级特性
  197. 8.3.1 路由前缀
  198. 8.3.2 本地跳转
  199. 8.3.3 过滤器实现种类
  200. 8.3.4 入口规则配置
  201. 8.3.5 Zuul过滤器生命周期
  202. 8.3.6 Zuul过滤器禁用
  203. 8.3.7 Zuul过滤器的数据传递
  204. 8.3.8 服务降级处理
  205. 8.3.9 全局限流配置
  206. 8.3.10 局部限流配置
  207. 8.4 本章小结
  208. 第9章 Gateway网关
  209. 9.1 Gateway简介
  210. 9.1.1 Gateway的组成
  211. 9.1.2 Gateway实例
  212. 9.1.3 Gateway转发规则
  213. 9.2 本章小结
  214. 第10章 Admin管理中心
  215. 10.1 Admin实例
  216. 10.1.1 Admin服务端
  217. 10.1.2 Admin客户端
  218. 10.1.3 创建Eureka项目
  219. 10.1.4 查看服务日志
  220. 10.2 Admin高级特性
  221. 10.2.1 集成Hystrix UI展示
  222. 10.2.2 Admin安全配置
  223. 10.2.3 拦截监控端点处理
  224. 10.2.4 Session监控
  225. 10.2.5 展示客户端JMX信息
  226. 10.2.6 监控客户端配置
  227. 10.2.7 服务端集成Hystrix UI展示
  228. 10.2.8 监控告警服务
  229. 10.3 本章小结
  230. 第11章 文档管理工具
  231. 11.1 Swagger实例构建
  232. 11.1.1 Swagger响应
  233. 11.1.2 Springfox-Swagger简介
  234. 11.1.3 Swagger相关依赖
  235. 11.1.4 Swagger文件配置
  236. 11.1.5 Swagger启动
  237. 11.2 Swagger注解
  238. 11.2.1@Api接口注解
  239. 11.2.2@ApiIgnore隐藏接口
  240. 11.2.3@ApiOperation方法注解
  241. 11.2.4@ApiImplicitParam参数注解
  242. 11.2.5@ApiResponse和@ApiResponses响应注解
  243. 11.2.6@ApiModel参数注解
  244. 11.2.7@ApiModelProperty字段注解
  245. 11.3 Swagger实例
  246. 11.3.1 项目结构
  247. 11.3.2 项目配置文件
  248. 11.3.3 权限模块
  249. 11.3.4 用户模块
  250. 11.3.5 订单模块
  251. 11.3.6 支付模块
  252. 11.3.7 商城模块
  253. 11.3.8 启动应用
  254. 11.3.9 请求认证
  255. 11.4 Postman使用方式
  256. 11.4.1 Postman基本使用方法
  257. 11.4.2 Postman主页
  258. 11.4.3 创建新的接口
  259. 11.4.4 接口集合
  260. 11.5 本章小结
  261. 第12章 MongoDB数据库
  262. 12.1 MongoDB简介
  263. 12.1.1 MongoDB的结构
  264. 12.1.2 MongoDB的特点
  265. 12.1.3 应用场景
  266. 12.1.4 可视化客户端
  267. 12.1.5 下载和安装
  268. 12.2 MongoDB实例
  269. 12.2.1 MongoDB依赖
  270. 12.2.2 MongoDB创建数据库
  271. 12.2.3 创建实体
  272. 12.2.4 用户方法
  273. 12.2.5 订单方法
  274. 12.2.6 支付方法
  275. 12.2.7 商品方法
  276. 12.3 MongoDB高级特性
  277. 12.3.1 MongoDB存储引擎
  278. 12.3.2 WiredTiger引擎
  279. 12.3.3 In-Memory引擎
  280. 12.3.4 不同存储引擎的区别
  281. 12.3.5 写安全机制
  282. 12.3.6 事务管理
  283. 12.3.7 数据回滚机制
  284. 12.3.8 MongoDB数据备份
  285. 12.3.9 MongoDB内存释放
  286. 12.3.10 MongoDB复制集
  287. 12.3.11 MongoDB元数据
  288. 12.3.12 MongoDB分片
  289. 12.4 本章小结
  290. 第13章 Redis缓存
  291. 13.1 Redis的基础用法
  292. 13.1.1 Redis的安装和启动
  293. 13.1.2 Redis可视化客户端
  294. 13.2 Redis实例
  295. 13.2.1 Redis组件
  296. 13.2.2 Redis信息配置
  297. 13.2.3 Redis key值存在判断
  298. 13.2.4 Redis设置key值
  299. 13.2.5 Redis获取key值
  300. 13.2.6 Redis缓存值
  301. 13.2.7 Redis缓存时间
  302. 13.2.8 Redis缓存过期时间设置
  303. 13.2.9 Redis获取缓存时间
  304. 13.2.10 Redis缓存删除
  305. 13.2.11 Redis缓存集合添加
  306. 13.2.12 Redis缓存集合查询
  307. 13.2.13 Redis根据key获取set集合
  308. 13.2.14 Redis整合缓存方法
  309. 13.2.15 设置key在指定时间过期
  310. 13.2.16 模糊匹配删除key
  311. 13.2.17 持久化key
  312. 13.2.18 哈希存储
  313. 13.2.19 读取哈希值
  314. 13.2.20 删除哈希值
  315. 13.3 Redis高级特性
  316. 13.3.1 Redis内部结构
  317. 13.3.2 最大缓存配置
  318. 13.3.3 Redis容量估算
  319. 13.3.4 Redis数据淘汰策略
  320. 13.3.5 Redis缓存算法
  321. 13.3.6 Redis事务
  322. 13.3.7 分区
  323. 13.3.8 Redis的序列化
  324. 13.3.9 Redis过期键删除策略
  325. 13.3.10 Redis锁机制
  326. 13.3.11 Redis单线程
  327. 13.3.12 Redis常见注解
  328. 13.3.13 Redis集群模式
  329. 13.3.14 持久化机制
  330. 13.3.15 Redis危险命令
  331. 13.4 缓存异常情况
  332. 13.4.1 缓存雪崩
  333. 13.4.2 缓存穿透
  334. 13.4.3 缓存击穿
  335. 13.5 本章小结
  336. 第14章 异步消息队列Kafka
  337. 14.1 Kafka基本介绍
  338. 14.1.1 Kafka的定义和组件
  339. 14.1.2 Kafka消息协议
  340. 14.1.3 Kafka的优点
  341. 14.1.4 Kafka环境部署
  342. 14.1.5 Kafka可视化工具
  343. 14.2 Kafka实例
  344. 14.2.1 Kafka依赖
  345. 14.2.2 Kafka消息消费者
  346. 14.2.3 Kafka消息生产者
  347. 14.2.4 消息体构造
  348. 14.3 Kafka高级机制
  349. 14.3.1 Kafka分区机制
  350. 14.3.2 Kafka流式处理
  351. 14.3.3 Kafka副本和备份
  352. 14.3.4 消息持久化
  353. 14.3.5 数据存储
  354. 14.3.6 Kafka消费模型
  355. 14.3.7 Kafka日志配置
  356. 14.3.8 Kafka负载均衡
  357. 14.3.9 Kafka单元测试
  358. 14.4 Kafka常见问题
  359. 14.4.1 消息可靠性
  360. 14.4.2 Kafka消息丢失的问题
  361. 14.4.3 顺序消费
  362. 14.4.4 重复消费
  363. 14.5 Bus整合Kafka
  364. 14.5.1 Bus架构
  365. 14.5.2 项目结构
  366. 14.5.3 Bus和Kafka
  367. 14.5.4 项目启动
  368. 14.5.5 指定刷新范围
  369. 14.6 Bus整合RabbitMQ
  370. 14.6.1 Erlang安装
  371. 14.6.2 Bus服务端文件配置
  372. 14.6.3 Bus启动
  373. 14.7 本章小结

FAQ

Can I read this book directly without a microservices background?
Yes, but you need basic experience with Java and Spring Boot first. This is an introductory hands-on tutorial with concise chapters, focused on building each component by hand; if you are not yet familiar with Spring Boot's project structure and configuration approach, it is better to build up the basics first, otherwise you may get stuck on environment setup.
The component versions in the book are somewhat old—is it still worth reading?
The content was written in 2021, so some component versions and configuration syntax may have changed. The book's value, however, lies in helping you build an overall understanding of the microservice component system and a mindset for technology selection—ideas that remain relatively stable. Use the book to clarify the overall picture and rely on official documentation for specific configuration.
What is the use of the book's comparisons of alternative components?
When explaining a component, the book compares it with its alternatives—for example, Eureka versus Consul for service registry, and Zuul versus Gateway for API gateway. Such comparisons help readers understand the positioning and trade-offs of different solutions and make more suitable technology choices in real projects, rather than merely memorizing one way of using something.

Comments

Find this book

This site is an index: you start “Search all sources” in your browser, and the entries it lists all point to third-party sites; please judge their availability yourself.

About the author

徐文聪 Author · China

Xu Wencong is a Chinese author about whom very limited information is publicly available. One work by this author is known: Spring Cloud Development in Practice, which is classified under programming and design. Judging from the subject matter, the author focuses on the practice of microservice development based on Spring Cloud, a kind of technical writing aimed at developers that emphasizes practical application rather than extended theoretical discussion. Since only this one work is included in the collection, it is not yet possible to assess the full range of the author's writing style or to trace a broader body of work; what can be confirmed is that this book is the main entry point for readers to understand the author's technical approach. For readers who wish to learn Spring Cloud application development, practical books of this kind often serve as an introduction and reference, with the author organizing content around concrete development scenarios to help readers understand how to use the relevant technical frameworks. Public information on Xu Wencong's education, professional experience, and other works is limited, and no speculation is offered here.

Top rated in the same category