bdf3 is a progressive enterprise-level development framework based on Spring Boot componentization. Provides a series of enterprise-level common module functions. Using the bdf3 framework in business projects, we can directly focus on the development of business function modules.
Welcome everyone to contact us: technical exchanges, business cooperation, joint construction of open source, etc.
Non-multi-tenant mode:
Multi-tenant mode:
Among them, the company ID is master and the username/password is admin/123456
Please use your mobile phone to scan the QQ (609822297) group QR code at the end of this article and join the group to obtain development documents.
bdf3 is implemented based on the Spring Boot automatic configuration mechanism. It achieves zero configuration, can be used out of the box, and has no additional learning costs. bdf3 also provides a series of pom type Starter modules, which are similar to the Starter modules provided by Spring Boot. The Starter module simplifies bdf3 Module dependency management makes project dependencies simpler and easier to maintain.
Create a standard Maven project with the name bdf3 -sample, the project packaging type is jar, and the project's parent project points to bdf3 -starter-parent. The final generated pom file is as follows:
< 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 提供的预定义依赖 Starter, bdf3 还提供了其他的 Starter -->
< dependency >
< groupId >com.bstek. bdf3 </ groupId >
< artifactId > bdf3 -starter</ artifactId >
</ dependency >
<!-- 开发测试工具 -->
< dependency >
< groupId >org.springframework.boot</ groupId >
< artifactId >spring-boot-devtools</ artifactId >
< scope >provided</ scope >
</ dependency >
<!-- 数据库驱动,正式场景改为 mysql、oracle 等等数据库驱动 -->
< 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 );
}
}
Through the above two steps, a basic bdf3 framework project is built. Directly run the project's startup class (run the main static method) sample download.
In Spring's configuration, configure as follows:
# 文件 application.properties
# 服务器端口设置
server.port = 8080
# 项目上下文路由
server.context-path=/bdf
# 是否打印sql语句
spring.jpa.showSql=true
#hibernate 反向创建表设置,update启动时更新表结构,create 启动时重新创建表结构,none 启动时不检查
spring.jpa.hibernate.ddl-auto=update
# Spring Boot 热部署设置,添加以下文件匹配规则,改动不重启。
spring.devtools.restart.additional-exclude=com/**
#数据库脚本的编码设置为 UTF-8
spring.datasource.sql-script-encoding=UTF-8
# 数据源配置,pom 中需要引入对应的数据库 jdbc 依赖,以下使用 mysql 数据库为例
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
# 如果数据库为非嵌入式数据库,这个属性第一次启动的时候一定要设置为ALWAYS,用于初始化数据,初始化好后,可以关闭,也可以不关闭,有自己决定
spring.datasource.initialization-mode=ALWAYS
Spring Boot Documentation Tutorial