BDF3漸進式企業(yè)級開發(fā)框架
BDF3 是基于 Spring Boot 組件化的漸進式企業(yè)級開發(fā)框架。 提供一系列企業(yè)級通用模塊功能,使用 BDF3 框架在業(yè)務(wù)項目,我們可以直接專注到業(yè)務(wù)功能模塊的開發(fā)。
歡迎大家聯(lián)系我們:技術(shù)交流、商業(yè)合作、共建開源等。
非多租戶模式:
多租戶模式:
特征
- 零配置,開箱即用?;?Spring Boot 自動配置機制實現(xiàn)
- 前端界面可視化開發(fā),基于 Dorado 展現(xiàn)中間件實現(xiàn)
- 前端組件標準化,后端開發(fā)者也能輕松開發(fā)前端
- 抽象業(yè)務(wù)通用能力,提供通用功能模塊,這些通用模塊開箱即用,如權(quán)限管理、多租戶、工作流、報表、實時通信、公眾號、微程序、云數(shù)據(jù)庫管理、規(guī)則引擎、日志、菜單、認證、字典、數(shù)據(jù)導入和導出等等
- 基于角色的權(quán)限授權(quán),權(quán)限粒度為組件級別
- 開發(fā)企業(yè)管理系統(tǒng)效率極高
- 多數(shù)據(jù)源智能切換、開啟事務(wù)
- 多租戶支持,橫向無限擴展,傳統(tǒng)項目零代碼切換為多租戶項目
- 提供豐富多樣的主頁面選擇
- 功能組件化,自由選擇需要的組件
- 基于 JPA 實現(xiàn)的極簡、可讀性高的結(jié)構(gòu)化查詢 Linq,與 Dorado 無縫集成
- 基于 Spring Security 實現(xiàn)的認證與授權(quán),開箱即用
在線演示
其中,公司 ID 為 master,用戶名/密碼為 admin/123456
快速開始
BDF3 基于 Spring Boot 自動配置機制實現(xiàn),做到了零配置,開箱即用,沒有額外學習成本,BDF3 也提供了一系列 pom 類型的 Starter 模塊,也 Spring Boot 提供的 Starter 模塊類似,Starter 模塊簡化了 BDF3 的模塊依賴管理,讓項目依賴變得更為簡單,好維護。
第一步:初始化一個標準的 Maven 項目
創(chuàng)建一個標準的 Maven 項目,名稱為 bdf3-sample,項目打包類型為 jar,項目的父項目指向 bdf3-starter-parent。最終生成的 pom文件如下:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <!-- 繼承的 BDF3 提供的依賴管理的父項目 --> <parent> <groupId>com.bstek.bdf3</groupId> <artifactId>bdf3-starter-parent</artifactId> <version>1.1.0-SNAPSHOT</version> </parent> <artifactId>bdf3-sample</artifactId> <dependencies> <!-- 添加 BDF3 提供的預(yù)定義依賴 Starter,BDF3 還提供了其他的 Starter --> <dependency> <groupId>com.bstek.bdf3</groupId> <artifactId>bdf3-starter</artifactId> </dependency> <!-- 開發(fā)測試工具 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <scope>provided</scope> </dependency> <!-- 數(shù)據(jù)庫驅(qū)動,正式場景改為 mysql、oracle 等等數(shù)據(jù)庫驅(qū)動 --> <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> </dependency> </dependencies> <!-- BDF3 提供的模塊存放的 maven 私服倉庫 --> <repositories> <repository> <id>bsdn-maven-repository</id> <url>http://nexus.bsdn.org/content/groups/public/</url> </repository> </repositories> </project>
第二步:啟動類
package com.bstek.bdf3.sample; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cache.annotation.EnableCaching; /** * @author Kevin Yang (mailto:[email protected]) * @since 2016年12月10日 */ @SpringBootApplication // Spring Boot 啟動類注解 @EnableCaching // 開啟緩存功能注解 public class SampleApplication { public static void main(String[] args) throws Exception { SpringApplication.run(SampleApplication.class, args); } }
通過以上兩個步驟,一個基本的BDF3 框架的項目就搭建好了。直接運行項目的啟動類(運行 main 靜態(tài)方法)示例下載。
數(shù)據(jù)源與 JPA 配置
在 Spring 的配置中,如下配置:
# 文件 application.properties
# 服務(wù)器端口設(shè)置
server.port = 8080
# 項目上下文路由
server.context-path=/bdf
# 是否打印sql語句
spring.jpa.showSql=true
#hibernate 反向創(chuàng)建表設(shè)置,update啟動時更新表結(jié)構(gòu),create 啟動時重新創(chuàng)建表結(jié)構(gòu),none 啟動時不檢查
spring.jpa.hibernate.ddl-auto=update
# Spring Boot 熱部署設(shè)置,添加以下文件匹配規(guī)則,改動不重啟。
spring.devtools.restart.additional-exclude=com/**
#數(shù)據(jù)庫腳本的編碼設(shè)置為 UTF-8
spring.datasource.sql-script-encoding=UTF-8
# 數(shù)據(jù)源配置,pom 中需要引入對應(yīng)的數(shù)據(jù)庫 jdbc 依賴,以下使用 mysql 數(shù)據(jù)庫為例
spring.datasource.continue-on-error=true
spring.datasource.url=jdbc:mysql://localhost:3306/bdf3
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
# 如果數(shù)據(jù)庫為非嵌入式數(shù)據(jù)庫,這個屬性第一次啟動的時候一定要設(shè)置為ALWAYS,用于初始化數(shù)據(jù),初始化好后,可以關(guān)閉,也可以不關(guān)閉,有自己決定
spring.datasource.initialization-mode=ALWAYS
Spring Boot 文檔教程
評論
圖片
表情
