lWoHvYe / unicorn

基于最新的Java 21和SpringBoot 3.2。根据eladmin项目进行改造。整合常用的Components.
https://lwohvye.github.io/unicorn/
Apache License 2.0
39 stars 21 forks source link
gradle java jpa kotlin lwohvye oauth2 spring-boot spring-security unicorn virtual-threads websocket
Chaste Unicorn Unicorn
[![AUR](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg)](https://github.com/lWoHvYe/unicorn/blob/main/LICENSE) [![GitHub stars](https://img.shields.io/github/stars/lWoHvYe/unicorn.svg?style=social&label=Stars)](https://github.com/lWoHvYe/unicorn) [![GitHub forks](https://img.shields.io/github/forks/lWoHvYe/unicorn.svg?style=social&label=Fork)](https://github.com/lWoHvYe/unicorn) [![Dependency Review](https://github.com/lWoHvYe/unicorn/actions/workflows/dependency-review.yml/badge.svg)](https://github.com/lWoHvYe/unicorn/actions/workflows/dependency-review.yml) [![CodeQL](https://github.com/lWoHvYe/unicorn/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/lWoHvYe/unicorn/actions/workflows/codeql-analysis.yml) [![Gradle Package](https://github.com/lWoHvYe/unicorn/actions/workflows/gradle-publish.yml/badge.svg)](https://github.com/lWoHvYe/unicorn/actions/workflows/gradle-publish.yml) [![Qodana](https://github.com/lWoHvYe/unicorn/actions/workflows/qodana_code_quality.yml/badge.svg?branch=main)](https://github.com/lWoHvYe/unicorn/actions/workflows/qodana_code_quality.yml)

本项目在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,相关详见


引用方式 🎵

最新版本为: Maven Central

Maven

<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>
Gradle
// 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的前后端分离的脚手架。 在各模块基本解耦之后,可根据需要只引入部分模块实现相关职能。

项目源码

后端源码 前端源码
原项目-github https://github.com/elunez/eladmin https://github.com/elunez/eladmin-web
原项目-码云 https://gitee.com/elunez/eladmin https://gitee.com/elunez/eladmin-web
github https://github.com/lWoHvYe/unicorn https://github.com/lWoHvYe/unicorn-web

主要特性

系统功能

项目结构

项目采用按功能分模块的开发方式,结构如下

详细结构

- 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)

运行环境

特别鸣谢


Feature list

TODO