🚀 易鹏快捷开发框架使用指南
项目下载
所需中间件及环境
- JDK 17/21 必须
- Maven >= 3.6 必须
- Redis 必须
- MinIO 必须(文件管理)、可替换成OBS
- MySQL 可修改成其他数据库、默认MySQL >= 8.0
初始化配置
- 定位到源码中的
yipeng-auth项目,进入其resources目录,找到名为application.yml的配置文件,把Redis、mysql、MinIO地址改成你自己的
yaml-数据库
spring:
application:
name: authentication
datasource:
dynamic:
primary: yipeng_auth
strict: true
datasource:
yipeng_auth:
url: jdbc:mysql://127.0.0.1:3306/yipeng_auth?useUnicode=true&autoReconnect=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=false&zeroDateTimeBehavior=CONVERT_TO_NULL
username: username
password: password
driver-class-name: com.mysql.cj.jdbc.Driver
kp:
project-name: 鉴权项目 # 项目名称yaml-redis
data:
redis:
host: 127.0.0.1 # Redis服务器地址
port: 6379 # Redis服务器连接端口
password: password # Redis服务器连接密码(默认为空)
database: 0 # Redis数据库索引(默认为0)
timeout: 60s # 连接空闲超过N(s秒、ms毫秒,不加单位时使用毫秒)后关闭,0为禁用,这里配置值和tcp-keepalive值一致
lettuce: # Lettuce连接池配置
pool:
max-active: 10 # 允许最大连接数,默认8(负值表示没有限制),推荐值:大于cpu * 2,通常为(cpu * 2) + 2 Lettuce 是多路复用(single connection, async),不像 Jedis 那样每个操作占一个连接。 通常 1~2 个物理连接就能支撑高并发
max-idle: 8 # 最大空闲连接数,默认8,推荐值:cpu * 2
min-idle: 2 # 最小空闲连接数,默认0
max-wait: 5s # 连接用完时,新的请求等待时间(s秒、ms毫秒),超过该时间抛出异常,默认-1(负值表示没有限制)
cache:
type: redis # 指定缓存用Redis,开启缓存注解核心开关yaml-minio
kp:
minio:
url: http://127.0.0.1:9000
user-name: username
password: passwordyaml-日志打印
# --------------以下配置只在本地开发环境加 部署服务时务必删除 ----------------------
logging:
level:
org.springframework.cloud.gateway: TRACE
org.springframework.cloud.loadbalancer: DEBUG
com.github.xiaoymin.knife4j.gateway: DEBUG
com.github.xiaoymin.knife4j.core: DEBUG
log:
path: ./logs/gateway # 相对路径:文件夹不存在自动创建
# ----------------------------------------------------------------------------------启动后端系统
启动前端代码:下载前端代码,然后启动,具体操作请参考前端文档
恭喜您,易鹏系统已经搭建完成,现在开始体验吧!
更多使用指南
想要深入了解其他用户的实际应用案例和最佳实践经验?欢迎查阅社区精心整理的详细使用总结文档👇
切换其他数据源
易鹏框架原生支持多类型数据库适配,包括 MySQL、Oracle、SQL Server、PostgreSQL 等; 其中开源系统(鉴权系统、周汇通)当前已完成 MySQL、PostgreSQL 两种数据库的适配。
鉴权系统、周汇通默认使用 MySQL 作为数据源,若需切换至 PostgreSQL,仅需修改 application.yml 配置文件中 flyway.locations 配置项: 将原配置值 classpath:db 替换为 classpath:pgsql 即可,完整配置示例如下:
yaml
flyway:
enabled: true # 是否开启 Flyway
encoding: UTF-8
locations: classpath:pgsql # 设置 Flyway 的 SQL 文件位置
baseline-on-migrate: true
sql-migration-prefix: V
sql-migration-separator:
sql-migration-suffixes: sql
validate-on-migrate: true
fail-on-missing-locations: false
clean-disabled: true在对应项目配置文件下,把数据源改成 PostgreSQL,完整配置示例如下:
yaml
spring:
datasource:
dynamic:
primary: yipeng_auth
strict: true
datasource:
yipeng_auth:
url: jdbc:postgresql://127.0.0.7:5432/yipeng_auth_dev?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: username
password: password
driver-class-name: org.postgresql.Driver💡 提示: 如需适配其他数据库(如 Oracle、SQL Server),可基于易鹏框架进行扩展开发,或关注官方后续版本更新。
