# 微服务化 **Repository Path**: buaa_zyf/microservices ## Basic Information - **Project Name**: 微服务化 - **Description**: No description available - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-08-29 - **Last Updated**: 2025-08-30 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Course Hub Microservices 这是一个基于Spring Boot和Spring Cloud的微服务架构项目,用于课程管理系统。 ## 项目结构 ``` microservices/ ├── eureka-server/ # 服务注册中心 ├── api-gateway/ # API网关 ├── user-service/ # 用户服务 ├── course-management-service/ # 课程管理服务 ├── class-management-service/ # 班级管理服务 ├── exercise-service/ # 作业练习服务 └── pom.xml # 父级POM文件 ``` ## 服务说明 ### Eureka Server (端口: 8761) - 服务注册与发现中心 - 所有微服务都会注册到此服务 ### API Gateway (端口: 8090) - 统一入口,路由请求到各个微服务 - 提供负载均衡和服务发现功能 - 支持CORS跨域配置 ### User Service (端口: 8080) - 用户管理服务 - 提供用户注册、登录、信息管理等功能 - 支持JWT认证和授权 ### Course Management Service (端口: 8081) - 课程管理服务 - 提供课程创建、查询、管理等功能 - 管理课程章节和教学材料 ### Class Management Service (端口: 8082) - 班级管理服务 - 提供班级创建、学生管理等功能 - 处理学生加入和退出班级 ### Exercise Service (端口: 8083) - 作业练习服务 - 提供作业创建、提交、评分等功能 - 支持多种作业类型(作业、测验、考试、练习) ## 快速开始 ### 前置要求 - Java 17+ - Maven 3.6+ - MySQL 8.0+ ### 启动顺序 1. 启动 Eureka Server 2. 启动 API Gateway 3. 启动各个业务服务 (User Service, Course Management Service, Class Management Service, Exercise Service) ### 构建项目 ```bash # 构建所有模块 mvn clean install # 构建特定模块 cd user-service mvn clean install ``` ### 运行服务 ```bash # 启动Eureka Server cd eureka-server mvn spring-boot:run # 启动API Gateway cd api-gateway mvn spring-boot:run # 启动User Service cd user-service mvn spring-boot:run # 启动Course Management Service cd course-management-service mvn spring-boot:run # 启动Class Management Service cd class-management-service mvn spring-boot:run # 启动Exercise Service cd exercise-service mvn spring-boot:run ``` ## 访问地址 - Eureka Dashboard: http://localhost:8761 - API Gateway: http://localhost:8090 - User Service: http://localhost:8080 - Course Management Service: http://localhost:8081 - Class Management Service: http://localhost:8082 - Exercise Service: http://localhost:8083 ## API路由 通过API Gateway访问各服务: - 用户相关: http://localhost:8090/api/users/** - 认证相关: http://localhost:8090/api/auth/** - 课程相关: http://localhost:8090/api/courses/** - 班级相关: http://localhost:8090/api/classes/** - 作业相关: http://localhost:8090/api/exercises/** ## 技术栈 - Spring Boot 3.x - Spring Cloud 2023.x - Spring Security - Spring Data JPA - MySQL - Maven