# loong-springboot-study **Repository Path**: supervol/loong-springboot-study ## Basic Information - **Project Name**: loong-springboot-study - **Description**: 专注于Spring Boot学习与实践的开源学习项目,适合学生或刚工作三年内的人员。代码完全免费,感谢支持。 - **Primary Language**: Java - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 0 - **Created**: 2025-07-07 - **Last Updated**: 2025-09-05 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Spring Boot 学习项目文档 ## 项目概述 本项目是一个Spring Boot学习项目集合,包含多个模块,每个模块针对Spring Boot的不同特性和功能进行实践和探索,如AOP、缓存、ORM、文档生成等。通过这些模块,可以深入了解Spring Boot的各种功能和应用场景。 ## 项目结构 项目采用Maven多模块结构,主要模块如下: ### 根模块 `loong-springboot-study` - **groupId**: `com.loong.boot` - **artifactId**: `loong-springboot-study` - **version**: `1.0.0` - **描述**: 整个项目的父模块,管理全局配置和依赖。 - **属性配置**: - `java.version`: `21` - `spring-boot.version`: `3.4.2` - `mapstruct.version`: `1.6.3` - `lombok.version`: `1.18.36` - **插件配置**: - `maven-checkstyle-plugin`: 代码风格检查,使用自定义规则文件 `loong_checkstyle_checks.xml`,发现违规时构建失败。 - `maven-pmd-plugin`: 代码质量检查,使用自定义规则文件 `loong_pmd_checks.xml`,发现违规时构建失败。 - `maven-compiler-plugin`: 编译插件,配置Lombok和MapStruct注解处理器。 ### 子模块 #### 1. `springboot-aop` - **描述**: AOP相关功能模块,包含AOP示例和Redisson分布式锁示例。 - **子模块**: - `springboot-aop-demo`: AOP示例项目。 - `springboot-redisson-lock`: Redisson分布式锁示例项目。 #### 2. `springboot-auth` - **描述**: 认证授权相关功能。 - **子模块**: - `springboot-security`: spring-security项目。 #### 3. `springboot-cache` - **描述**: 缓存相关功能模块,包含Redis和Redisson缓存示例。 - **子模块**: - `springboot-redis`: Redis缓存示例项目。 - `springboot-redisson`: Redisson缓存示例项目。 #### 4. `springboot-common` - **描述**: 通用模块,提供项目中通用的工具类和配置。 - **依赖**: `lombok` #### 5. `springboot-configuration` - **描述**: 配置相关功能模块,包含异常配置子模块。 - **子模块**: - `springboot-configuration-exception`: 异常配置示例项目。 #### 6. `springboot-db` - **描述**: 数据库相关功能模块,包含ID生成、HikariCP和Druid连接池示例。 - **子模块**: - `springboot-id`: ID生成示例项目。 - `springboot-hikaricp`: HikariCP连接池示例项目。 - `springboot-druid`: Druid连接池示例项目。 #### 7. `springboot-doc` - **描述**: 文档生成相关功能模块,包含OpenAPI和Knife4j文档示例。 - **子模块**: - `springboot-openapi`: OpenAPI文档示例项目。 - `springboot-knife4j`: Knife4j文档示例项目。 #### 8. `springboot-env` - **描述**: 环境配置相关功能模块,包含Maven环境配置示例。 - **子模块**: - `springboot-env-config`: 环境配置示例项目。 - `springboot-env-maven`: Maven环境配置示例项目,支持开发、本地、测试和生产环境切换。 #### 9. `springboot-ioc` - **描述**: IOC相关功能模块,包含IOC示例项目。 - **子模块**: - `springboot-ioc-demo`: IOC示例项目。 #### 10. `springboot-lock` - **描述**: 锁相关功能模块,包含本地锁和分布式锁示例。 - **子模块**: - `springboot-local-lock`: 本地锁示例项目。 - `springboot-distributed-lock`: 分布式锁示例项目。 #### 11. `springboot-log` - **描述**: 日志相关功能模块,包含Logback日志示例。 - **子模块**: - `springboot-logback`: Logback日志示例项目。 #### 12. `springboot-mq` - **描述**: 消息队列相关功能模块,包含RabbitMQ示例。 - **子模块**: - `springboot-rabbitmq`: RabbitMQ示例项目。 #### 13. `springboot-office` - **描述**: 办公文档处理相关功能模块,包含Excel处理示例。 - **子模块**: - `springboot-excel`: Excel处理示例项目。 #### 14. `springboot-orm` - **描述**: ORM相关功能模块,包含JPA、MyBatis和MyBatis-Plus示例。 - **子模块**: - `springboot-jpa`: JPA示例项目。 - `springboot-mybatis`: MyBatis示例项目。 - `springboot-mybatisplus`: MyBatis-Plus示例项目。 #### 15. `springboot-oss` - **描述**: 对象存储相关功能模块,包含MinIO示例。 - **子模块**: - `springboot-minio`: MinIO示例项目。 #### 16. `springboot-web` - **描述**: Web相关功能模块,包含Web示例项目。 - **子模块**: - `springboot-web-example`: Web示例项目。 #### 17. `springboot-workflow` - **描述**: 工作流相关功能模块,包含Flowable工作流示例。 - **子模块**: - `springboot-flowable`: Flowable工作流示例项目(调试中……)。 #### 18. `springboot-generator` - **描述**: 代码生成相关功能模块,包含MyBatis和MyBatis-Plus代码生成示例。 - **子模块**: - `springboot-generator-mybatis`: MyBatis代码生成示例项目。 - `springboot-generator-mybatisplus`: MyBatis-Plus代码生成示例项目。 ## 依赖管理 项目使用 `springboot-dependency` 模块进行依赖管理,统一管理项目中使用的各种依赖的版本,避免版本冲突。主要依赖如下: - `spring-boot-dependencies`: Spring Boot依赖管理。 - `redisson-spring-boot-starter`: Redisson分布式锁和缓存。 - `mysql-connector-j`: MySQL数据库驱动。 - `lombok`: Java代码简化工具。 - `mapstruct`: Java Bean映射工具。 - `mybatis-spring-boot-starter`: MyBatis集成Spring Boot。 - `mybatis-generator-core`: MyBatis代码生成器。 - `xxl-job-core`: XXL-Job分布式任务调度。 - `druid-spring-boot-3-starter`: Druid连接池。 - `mybatis-plus-spring-boot3-starter`: MyBatis-Plus集成Spring Boot。 - `springdoc-openapi-starter-webmvc-ui`: OpenAPI文档生成。 - `lombok-mapstruct-binding`: Lombok和MapStruct集成。 ## 构建和运行 ### 构建项目 在项目根目录下执行以下命令进行项目构建: ```sh mvn clean install ``` ### 运行项目 每个子模块都可以独立运行,以 `springboot-web-example` 为例,在该模块目录下执行以下命令启动项目: ```sh mvn spring-boot:run ``` ## 代码检查 项目配置了Checkstyle和PMD插件进行代码风格和质量检查,在构建过程中会自动执行检查,如果发现违规代码,构建将失败。可以通过以下命令手动执行检查: ```sh mvn checkstyle:check pmd:check ``` ## 环境配置 `springboot-env-maven` 模块支持多环境配置,通过Maven的Profile功能可以切换不同的环境,默认激活开发环境。可以通过以下命令指定不同的环境进行构建: ```sh mvn clean install -Pprod ``` 其中 `prod` 表示生产环境,还支持 `dev`(开发环境)、`local`(本地环境)和 `test`(测试环境)。 ## 注意事项 - 请确保本地安装了Java 21和Maven 3.x以上版本。 - 在运行涉及数据库和消息队列的模块时,请确保相应的服务已经启动,并且配置文件中的连接信息正确。 通过以上文档,你可以快速了解项目的结构、功能和使用方法,希望本项目能帮助你更好地学习和掌握Spring Boot的各种特性。 ## 捐赠支持 你的支持,就是我最大的动力,再次感谢。 - 微信 ![捐赠支持](./assets/donate/wx.png) - 支付宝 ![捐赠支持](./assets/donate/zfb.png) ## 个人简介 本人开发经验10年+,擅长Java开发和运维,主要在国企工作,进大厂勿扰。学习路线、面试答疑、工作答疑和问题答疑等! 微信号:rylzx8187