███╗ ███╗ ██████╗ ██████╗ ████████╗ ██╗ ███████╗ ███████╗ ████╗ ████║ ██╔═══██╗ ██╔══██╗ ╚══██╔══╝ ██║ ██╔════╝ ██╔════╝ ██╔████╔██║ ██║ ██║ ██████╔╝ ██║ ██║ ███████╗ █████╗ ██║╚██╔╝██║ ██║ ██║ ██╔══██╗ ██║ ██║ ╚════██║ ██╔══╝ ██║ ╚═╝ ██║ ╚██████╔╝ ██║ ██║ ██║ ██║ ███████║ ███████╗ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚══════╝ ╚══════╝ Built by RYMCU
一款现代化的后台管理脚手架项目,基于 Spring Boot 3.5.6 构建,集成了完整的认证授权、监控、缓存等企业级功能。
后端核心
- Spring Boot 3.5.6 - 主框架
- Spring Security 6 - 安全认证框架
- JWT (JJWT 0.12.5) - Token 认证
- MyBatis-Flex 1.11.0 - ORM 框架
- Redis - 缓存与会话存储
- PostgreSQL 17 - 主数据库
监控与运维
- Spring Boot Actuator - 应用监控
- Prometheus - 指标收集
- Grafana - 监控面板
- HikariCP - 数据库连接池监控
其他组件
- Resilience4j - 限流熔断
- Jasypt - 配置加密
- Apache Commons - 工具库集合
- X-File-Storage - 文件存储
- 用户管理 - 用户注册、登录、信息管理
- 角色管理 - 角色定义、权限分配
- 菜单管理 - 动态菜单、层级管理
- 权限管理 - 基于角色的访问控制 (RBAC)
- JWT 认证 - 无状态认证机制
- Redis 缓存 - 数据缓存与会话管理
- 监控集成 - Actuator + Prometheus + Grafana
- 限流保护 - Resilience4j 实现
- 配置加密 - 敏感配置加密存储
- 文档完善 - 详细的技术文档
- 字典管理 - 系统字典配置
- 事件日志 - 操作审计日志
- 对象存储 - 文件上传管理
- API 文档 - Swagger/OpenAPI 集成
- Java: Eclipse Temurin 21
- 数据库: PostgreSQL 17 (推荐) / MySQL 8.0+
- 构建工具: Maven 3.6.0+
- 缓存: Redis 6.0+
- IDE: IntelliJ IDEA / Eclipse
- Docker & Docker Compose (推荐)
- 操作系统: Windows 10+, macOS, Linux
-
克隆项目
git clone https://github.com/rymcu/mortise.git cd mortise
-
配置本地域名
# Windows .\update_hosts.bat # macOS/Linux ./update_hosts.sh
-
生成 SSL 证书
# 安装 mkcert # Windows: choco install mkcert # macOS: brew install mkcert # Linux: 参考官方文档 # 生成证书 mkcert -install mkcert -key-file key.pem -cert-file cert.pem rymcu.local *.rymcu.local
-
启动服务
docker-compose up -d
-
配置代理管理器
- 访问
http://localhost:81
- 默认账号:
[email protected]
/changeme
- 添加代理规则:
npm.rymcu.local
→app:81
auth.rymcu.local
→logto:3010
logto.rymcu.local
→logto:3011
rymcu.local
→app:80
- 访问
-
环境准备
# 确保已安装 Java 21, Maven, PostgreSQL, Redis java -version mvn -version
-
数据库配置
-- PostgreSQL CREATE DATABASE mortise; CREATE USER mortise WITH PASSWORD 'your_password'; GRANT ALL PRIVILEGES ON DATABASE mortise TO mortise;
-
配置文件
# 复制配置文件 cp src/main/resources/application-dev.yml.example src/main/resources/application-dev.yml # 修改数据库和 Redis 连接信息
-
启动应用
mvn spring-boot:run
应用启动后,可通过以下方式访问监控端点:
-
获取访问令牌
curl -X POST http://localhost:9999/mortise/api/v1/auth/login \ -H "Content-Type: application/json" \ -d '{"account":"your_account","password":"your_password"}'
-
访问监控端点
# 使用返回的 token curl -H "Authorization: Bearer <token>" \ http://localhost:9999/mortise/actuator/health
端点 | 描述 | URL |
---|---|---|
健康检查 | 应用整体健康状态 | /mortise/actuator/health |
应用信息 | 版本、环境信息 | /mortise/actuator/info |
性能指标 | JVM、系统指标 | /mortise/actuator/metrics |
Prometheus | 监控系统集成 | /mortise/actuator/prometheus |
端点列表 | 所有可用端点 | /mortise/actuator |
# prometheus.yml
scrape_configs:
- job_name: 'mortise-app'
static_configs:
- targets: ['localhost:9999']
metrics_path: '/mortise/actuator/prometheus'
scrape_interval: 15s
bearer_token: 'your_jwt_token'
推荐监控指标:
jvm_memory_used_bytes
- JVM内存使用jvm_gc_pause_seconds
- GC暂停时间hikaricp_connections_active
- 数据库连接数http_server_requests_seconds
- HTTP请求耗时
项目包含完整的技术文档,位于 docs/
目录:
查看完整文档列表:docs/README.md
- 代码风格遵循阿里巴巴 Java 开发手册
- 提交信息使用 Conventional Commits 格式
- 新增功能需要包含单元测试
- 重要变更需要更新相关文档
- Fork 本仓库
- 创建功能分支 (
git checkout -b feature/AmazingFeature
) - 提交变更 (
git commit -m 'feat: Add some AmazingFeature'
) - 推送到分支 (
git push origin feature/AmazingFeature
) - 打开 Pull Request
- 文档: 查阅 docs 目录下的技术文档
- 问题反馈: GitHub Issues
- 功能建议: GitHub Discussions
本项目基于 MIT License 开源协议。
感谢所有为本项目做出贡献的开发者:
更新日期: 2025-09-24
维护者: RYMCU 开发团队