本项目在eladmin项目的基础上,进行了部分扩展及尝试,在此表示感谢。
启动类 AppRun.java 和配置文件 resources 详见 unicorn-starter 模块。启停脚本。
Java16之后,默认强封装JDK内部类,详见JEP 396
JEP 403,需在启动时添加相关参数开启包访问。较简单的是添加
--add-opens java.base/java.lang=ALL-UNNAMED
,也可根据需要缩小范围(在Java 9引入的JPMS/Jigsaw)。
详见:Java 16 Java 17
Java 19起,引入Virtual Threads/Project Loom,相关详见
<project>
<project.core.version>4.4.0-sigma</project.core.version>
<!-- system模块 -->
<dependency>
<groupId>com.lwohvye</groupId>
<artifactId>unicorn-security</artifactId>
<version>${project.core.version}</version>
</dependency>
<!-- logging模块 -->
<dependency>
<groupId>com.lwohvye</groupId>
<artifactId>unicorn-logging</artifactId>
<version>${project.core.version}</version>
</dependency>
</project>
// 4.x系列基于Java 21, 部分module使用Kotlin, 使用Gradle build
ext { // 这个定义是可以传递的
unicornVersion = '4.4.0-sigma'
}
implementation "com.lwohvye:unicorn-security:$unicornVersion"
// 引入custom-bzLog
implementation("com.lwohvye:unicorn-security:$unicornVersion") {
capabilities {
// 这里只支撑横线,不支持驼峰
requireCapability('com.lwohvye:unicorn-security-business-log')
}
}
一个基于最新的Java 21(17) 版本、 Spring Boot 3.3、 Jpa、 Spring Security、RabbitMQ、Vue的前后端分离的脚手架。 在各模块基本解耦之后,可根据需要只引入部分模块实现相关职能。
项目采用按功能分模块的开发方式,结构如下
unicorn-core
系统的Core模块,BaseClass及各种Util,(基于Multi-Release JAR Files,Support Java 17 - 21),
baseline 为Java 17, 在Runtime = 17 时使用传统threadPool,在Runtime >= 21时使用Virtual Threads
unicorn-beans
基础Beans的Definition及Configuration,To C业务可只引入该dependency
unicorn-sys-api
Sys Module基础实体及API,方便服务拆分
unicorn-security
系统权限模块,包含权限配置管理等。
unicorn-logging
系统的日志模块,其他模块如果需要记录日志需要引入该模块,亦可自行实现
unicorn-tp-tools-kotlin
第三方工具模块,包含:邮件、S3,可视情况引入
unicorn-code-gen-kotlin
系统的代码生成模块。这部分待优化,亦非必须模块
unicorn-starter
启动类(Maven),项目入口,包含模块及组件配置(DB读写分离 + Cache读写分离)
valentine-starter
启动配置示例(Gradle),尝试Kotlin/Kotlinx
unicorn-oauth2
OAuth2 Sample,AuthorizationServer, OAuth2Client + Gateway, ResourceServer(Web MVC & WebFlux)
- unicorn-core 公共模块(Baseline Java 17)
- annotation 为系统自定义注解
- base 提供了Entity、Service、DTO基类和mapstruct的通用mapper
- exception 项目自定义异常类
- utils 系统通用工具类, security, json, rabbitmq, redis,...
- QueryHelp 基于Annotation的JPA动态查询Specification
- SpringContextHolder 自定义SpringUtil
- JDKUtils, UnsafeUtils
- XRabbitAbstractProducer, YRabbitAbstractConsumer
- SecurityUtils, ReactiveSecurityUtils
- java21/utils Virtual Threads for Java Runtime 21+ (Multi-Release Jar)
- unicorn-beans 基础Bean
- advice 统一数据返回及异常处理
- config 基础配置,Security配置,redis配置,openApi配置,Rsa配置等
- security 权限控制,为swarm化,提供全局关闭Security功能
- UnicornAutoConfiguration: 自动化装配
- ValentineExecutorConfig: Running Spring Applications (Servlet Web Servers & Task Execution) on Virtual Threads Before Spring Boot 3.2
- unicorn-sys-api 基础实体及DTO
- modules 基础实体及接口定义
- unicorn-security 系统核心模块
- common 配置跨域、静态资源、数据权限、实体表映射、系统完成入口
- config
- init 容器启动后的钩子call back
- orm jpa-entity的部分配置,eg: Table Mapping
- web corsFilter configurer and so on
- modules 系统相关模块(登录授权、消息队列、系统监控、定时任务、运维管理等)
- infrastructure business log相关
- mnt.websocket WebSocket
- quartz 定时任务
- rabbitmq 消息队列相关
- security 核心权限控制
- system 用户-权限管理
- unicorn-logging 系统日志模块
- aspect 基于Anno的log切面
- rabbitmq Async log
- unicorn-tp-tools-kotlin 系统第三方工具模块(kotlin)
- unicorn-code-gen-kotlin 系统代码生成模块(kotlin)
感谢 JetBrains 提供的非商业开源软件开发授权。
感谢 PanJiaChen 大佬提供的前端模板
感谢 Moxun 大佬提供的前端 Curd 通用组件
感谢 zhy6599 大佬提供的后端运维管理相关功能
感谢 j.yao.SUSE 大佬提供的匿名接口与Redis限流等功能
感谢 d15801543974 大佬提供的基于注解的通用查询方式
感谢 elunez 大佬提供的eladmin项目