# 课程demo **Repository Path**: javaweb-dev-tech/course-demo ## Basic Information - **Project Name**: 课程demo - **Description**: No description available - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-01-16 - **Last Updated**: 2026-01-31 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 🎓 Java Web 开发技术 - 课程实战演示 (Course Demo) [![Course Docs](https://img.shields.io/badge/Docs-课程在线文档-blue)](https://javaweb.chende.top/) [![Spring Boot](https://img.shields.io/badge/Spring%20Boot-3.5.9-green.svg)](https://spring.io/projects/spring-boot) [![Spring AI](https://img.shields.io/badge/Spring%20AI-1.0.0-blue.svg)](https://spring.io/projects/spring-ai) [![DeepSeek](https://img.shields.io/badge/Model-DeepSeek%20R1-purple.svg)](https://www.deepseek.com/) [![License](https://img.shields.io/badge/License-Apache%202.0-orange.svg)](./LICENSE) 欢迎来到 **武汉工商学院《Java Web 开发技术》** 课程代码仓库!🚀 本项目不仅仅是代码示例,更是你从一名 Java 初学者进阶为 **AI 全栈工程师** 的实战指南。在这里,你将见证一个简单的“图书管理系统”如何一步步进化为“能够听懂人话的 **SmartBook 智能二手书交易平台**”。 > 📘 **说明**:本项目是《Java Web 开发技术》课程的配套演示代码仓库。 > 所有代码案例均与课程电子文档 [javaweb.chende.top](https://javaweb.chende.top/) 章节一一对应。 --- ## 📂 项目简介 本项目不再是零散的代码片段,而是一个**循序渐进**的完整工程。从基础的 Spring Boot 启动,到 MyBatis 数据持久化,再到最新的 **Spring AI + DeepSeek** 智能体开发,最终构建一个的 **SmartBook 智能图书交易系统**。 ## 🛠️ 技术栈 (Tech Stack) 本项目采用目前业界主流的现代化技术体系: * **开发框架**: Spring Boot 3.5.9 + Spring AI * **持久层**: MyBatis + PageHelper * **数据库**: **MySQL** * **AI 框架**:Spring AI ( 1.0.0) * **AI 大模型**: **DeepSeek (深度求索)** / ModelScope (魔塔社区) * **新一代协议**:MCP (Model Context Protocol) * **运行环境**: JDK 17+ --- ## 🗺️ 课程代码导航 (Code Map) 代码按照课程章节演进,请根据包名或 Tag 查找对应源码。 | 章节 | 核心主题 | 关键代码/包路径 | 对应实验 | | :--- |:---------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------| | **Ch 01** | **Spring Boot HelloWorld** | `CourseDemoApplication` (Spring Boot 启动类)
`edu.wtbu...controller.HelloController` | [实验 1](https://javaweb.chende.top/chapter01/lab1/) | | **Ch 02** | **Web 底层原理** | - | - | | **Ch 03** | **RESTful 架构** | `edu.wtbu...controller.UserController`
`edu.wtbu...common.GlobalExceptionHandler` | [实验 3](https://javaweb.chende.top/chapter03/lab3/) | | **Ch 04** | **数据持久化** | `resources/mapper/*.xml` (动态SQL)
`edu.wtbu...service.impl.UserServiceMybatisImpl` (PageHelper) | [实验 4](https://javaweb.chende.top/chapter04/lab4/) | | **Ch 05** | **AI 智能体基础** | `edu.wtbu...ai.AiClientTest` (RestClient)
`edu.wtbu...tool.BookTools` (Tool Calling)
`edu.wtbu...controller.AiController` (Spring AI) | [实验 5](https://javaweb.chende.top/chapter05/lab5/) | | **Ch 05+**| **MCP 协议集成** | `application.properties` (MCP Client配置)
`AiController` (高德地图集成) | - | | **Ch 06** | **综合项目** | **SmartBook 智能图书交易系统** | [实验 6](https://javaweb.chende.top/chapter06/lab6/) | --- ## 🚀 快速开始 (Quick Start) ### 1. 环境准备 确保你的本地开发环境满足以下要求: * **JDK**: 17 或以上版本 * **Maven**: 3.6+ * **IDE**: IntelliJ IDEA 2023+ (推荐安装 **通义灵码** 和 **MyBatisX** 插件) * **数据库**: MySQL ### 2. 克隆项目 ```bash git clone https://gitee.com/javaweb-dev-tech/course-demo.git cd course-demo ``` ### 3. 配置数据库 在 MySQL 中执行 `sql/smart_book.sql` , 建表及插入示例数据. 修改 `src/main/resources/application.properties` 中数据库的配置。 ```properties # 数据库名称 (请修改为你自己的) spring.datasource.url=jdbc:mysql://localhost:3306/smart_book?serverTimezone=Asia/Shanghai&characterEncoding=utf-8&useSSL=false # 账号密码 (请修改为你自己的) spring.datasource.username=root spring.datasource.password=root1234 ``` ### 4. 配置 AI 密钥 (关键步骤) 🔑 为了安全起见,代码中的 API Key 已脱敏。你需要去 [魔塔社区 ModelScope](https://modelscope.cn/) 或 [DeepSeek 官网](https://www.deepseek.com/)申请免费 Key。 本项目使用了 **Spring AI** 连接大模型。你需要修改 `src/main/resources/application.properties`: ```properties # 替换成你自己的 Key spring.ai.openai.api-key= 你的密钥粘贴在这里 # 魔塔社区 或者 DeepSeek 官方接口 spring.ai.openai.base-url= https://api-inference.modelscope.cn # 或者 DeepSeek 官方API https://api.deepseek.com ``` ### 5. 启动前端调试页 本项目包含**零配置**的 HTML 调试页面。 运行 `CourseDemoApplication.java` 的 `main` 方法。启动 Spring Boot 后端。 1.浏览器访问: `http://localhost:8080/user.html` 用户模模块。 2. 浏览器访问: `http://localhost:8080/user_page.html` 用户模模块,CRUD, 分页 3. 浏览器访问: `http://localhost:8080/ai.html` 勾选 **"开启流式响应"**,即可体验像 ChatGPT 一样的打字机效果。 --- ## 🔗 相关链接 * 📖 **课程电子书**: [https://javaweb.chende.top](https://javaweb.chende.top) * 🛠️ **JetBrains 教育许可申请**: [查看指南](https://javaweb.chende.top/appendix/account-guide/) * 🤖 **ModelScope 模型社区**: [https://modelscope.cn](https://modelscope.cn) --- ## 🤝 贡献与反馈 如果你发现代码有 Bug 或文档有误,欢迎提交 Issue 或 Pull Request。 * 如果你发现代码有 Bug,欢迎提交 **Issue**。 * 保持代码风格一致。 * 提交前请先在本地运行通过。 **Happy Coding! ☕**