基于Spring Cloud的微服务架构的应用与实现

2021-04-03 23:46:40葛萌李闯男欧阳宏基
现代信息科技 2021年19期

葛萌 李闯男 欧阳宏基

摘  要:传统单体架构存在着开发技术单一、系统耦合度高、错误隔离性差、可收缩性差等缺点。微服务架构以分而治之、可收缩性强、模块独立开发、迭代周期短等优点逐渐成为新一代软件开发架构用来弥补单体架构的缺陷。介绍了微服务架构的基本概念,以Spring Cloud微服务框架为基础,利用Java语言、中间件技术和MySQL数据库设计并实现了一个教师教学评价系统。论述了微服务架构实现的关键步骤和系统核心模块的实现过程,为微服务架构在应用中的实现提供了一定的借鉴。

关键词:微服务架构;Spring Cloud;中间件技术;教学评价系统

中图分类号:TP311                  文献标识码:A文章编号:2096-4706(2021)19-0023-04

Application and Implementation of Microservice Architecture Based on Spring Cloud

GE Meng, LI Chuangnan, OUYANG Hongji

(School of Computer Science, Xianyang Normal University, Xianyang 712000, China)

Abstract: The traditional monomer architecture has some disadvantages, such as single development technology, high system coupling, poor error isolation, poor scalability and so on. Microservice architecture has gradually become a new generation of software development architecture to make up for the defects of monomer architecture with the advantages of divide and rule, strong contractibility, independent module development and short iteration cycle. This paper introduces the basic concept of microservice architecture, designs and implements a teacher teaching evaluation system based on Spring Cloud microservice framework, Java language, middleware technology and MySQL database. It discusses the key steps of implementation of microservice architecture and the implementation process of system core modules, which provides a certain reference for the implementation of microservice architecture in application.

Keywords: microservice architecture; Spring Cloud; middleware technology; teaching evaluation system

0  引  言

傳统的单体应用系统架构会随着软件规模和业务的扩大变得复杂且不易于扩展和维护,微服务架构的出现很好地解决了这个问题[1]。微服务架构是一种架构模式,它提倡将单一应用程序划分成一组小的服务,服务之间相互协调、互相配合,为用户提供最终价值。每个服务运行在其独立的进程中,服务和服务之间采用轻量级的通信机制相互沟通。每个服务都围绕着具体的业务进行构建,并且能够被独立的部署到生产环境、类生产环境等[2]。

本文以Spring Cloud为微服务架构的实现框架[3],以教师教学评价为业务背景,综合应用Maven管理工具、Mycat中间件、SSM框架[4]、Docker容器等技术,实现了微服务开发的基本流程,详细描述了核心模块的实现过程,Spring Clound框架的应用与实现提供了一定的参考。……

登录APP查看全文