首页
  • 2024.1.1.0
  • 2024.1.1.1
  • 2024.1.2.0
  • 2024.1.3.0
  • Java
  • Linux
  • Deploy
  • Application
关于
友情链接
GitHub (opens new window)

Xiao ku

板砖师傅
首页
  • 2024.1.1.0
  • 2024.1.1.1
  • 2024.1.2.0
  • 2024.1.3.0
  • Java
  • Linux
  • Deploy
  • Application
关于
友情链接
GitHub (opens new window)
  • 版本日志
  • 贡献清单
  • 2024.1.3.0

  • 2024.1.2.0

    • Simple-Starter概述
      • 核心依赖
      • Starter自动装配模块
      • Base服务类模块
      • Utils工具类模块
      • 基础配置模块
      • 仓库地址
      • 依赖关系
      • Base服务端
      • Demo示例
      • Simple支持配置项
      • 启动Service需修改的配置
        • BaseConfigSpringbootApplication
        • BaseS3ServiceApplication
        • BaseDictServiceApplication
      • 启动Demo需修改的配置
    • 自动装配模块

    • 服务类模块

    • 工具类模块

  • 2024.1.1.1

  • 2024.1.1.0

  • OpenSource
  • 2024.1.2.0
xiaoku
2023-03-13
目录

Simple-Starter概述

github: https://github.com/ok1996/ok-system-simple (opens new window)

# 核心依赖

Dependency Version
Java 17
Spring Boot 3.2.3
Spring Cloud 2023.0.0
Spring Cloud Alibaba 2023.0.0.0-RC1
Ok System Simple 2024.1.2.0

# Starter自动装配模块

模块名称 使用场景 说明
simple-starter-web Web应用 SpringBoot Web、集成接口文档、序列化格式转换、
响应信息主体、全局异常处理器
simple-starter-redisson 锁及缓存 注解使用:分布式锁、分布式幂等、分布式限流器;
Cacheable注解常用配置及自定义CacheName过期时间
simple-starter-s3 文件管理客户端 初始化客户端、提供基础服务方法
simple-starter-socketio 长链接通讯及集群 集群使用redis订阅及广播机制,无redis自动单机
simple-starter-grpc 远程调用协议接口 自定义注解Grpc简化使用:客户端、服务端
simple-starter-datasource 数据库连接应用 HikariCP、P6spy、自动创建数据库表、通用CURD控制层、几何类型处理器
simple-starter-freemarker 模板引擎应用 简化导入配置参数
simple-starter-cloud 微服务应用 微服务常用依赖集成:服务发现、远程配置中心等
simple-starter-gateway 微服务网关 微服务接口网关:集成微服务文档网关
simple-starter-encrypt 加密 注解:加密脱敏(加密规则有通用模板、或自定义)
注解:接口请求参数或返回参数Rsa加密解密
simple-starter-dict 字典 注解字典翻译(字典服务类开放自定义实现)
(支持单体字段、列表、实体嵌套)
simple-starter-email 邮件 Smtp邮件推送
simple-starter-package 构建打包 自定义Maven构建打包逻辑,将常用脚本及可执行文件统一打包

# Base服务类模块

模块名称 使用场景 说明
simple-base-config-api 基础配置-客户端 启动自动初始化配置、可选覆盖生成的依赖客户端
simple-base-config-service 基础配置-服务端 启动自动初始化配置、可选覆盖生成的依赖服务端
simple-base-s3-api 文件存储服务-客户端 提供文件管理服务及接口客户端
simple-base-s3-service 文件存储服务-服务端 提供文件管理服务及接口服务端
simple-base-dict-api 字典服务-客户端 提供字典服务管理客户端
simple-base-dict-service 字典服务-服务端 提供字典服务管理服务端
simple-base-generator-api 代码生成-客户端 提供数据库表代码生成工具类及实体对象
simple-base-generator-service 代码生成-服务端 提供根据参数初始化项目代码生成服务端

# Utils工具类模块

模块名称 使用场景 说明
simple-utils-jackson Json工具 提供 Json 序列化和反序列化功能的工具类
simple-utils-common 通用工具 提供常用及通用的工具类

# 基础配置模块

模块名称 使用场景 说明
simple-parent 项目父级管理 可用于管理项目的通用配置和依赖版本。统一管理项目的构建配置、依赖版本和插件版本
simple-dependencies 项目依赖管理 可用于集中管理项目中所有模块的依赖版本。定义了各个模块所需的依赖版本,并通过dependencyManagement标签进行统一管理

# 仓库地址

例 simple-starter-web
最新版本号 2024.1.2.0

    <dependencies>
        <dependency>
            <groupId>cn.iosd</groupId>
            <artifactId>simple-starter-web</artifactId>
            <version>2024.1.2.0</version>
        </dependency>
    </dependencies>
1
2
3
4
5
6
7

# 依赖关系

依赖关系图

# Base服务端

服务 HTTP端口号 端口号 说明
simple-base-config-service 9010 服务类-基础配置服务端
simple-base-s3-service 9020 服务类-文件管理服务端
simple-base-dict-service 9030 服务类-字典管理服务端
simple-base-generator-service 9040 服务类-工程代码生成服务端

# Demo示例

服务 HTTP端口号 端口号 说明
simple-demo-boot 11010 自动装配类-空项目启动示例
simple-demo-redisson 11020 自动装配类-锁使用示例
simple-demo-s3 11030 自动装配类-文件管理客户端基础使用示例
simple-demo-socketio-one 11040 SOCKETIO:12010 自动装配类-长连接通讯(单体/集群)1使用示例
simple-demo-socketio-two 11050 SOCKETIO:12020 自动装配类-长连接通讯(单体/集群)2使用示例
simple-demo-grpc-server 11060 GRPC:12030 自动装配类-Grpc服务端启动示例
simple-demo-grpc-client 11070 自动装配类-Grpc客户端使用示例
simple-demo-datasource 11080 自动装配类-数据库连接查询使用示例
simple-demo-freemarker 11090 自动装配类-freemarker页面使用示例
simple-demo-cloud 11100 自动装配类-微服务注册中心及配置中心使用示例
simple-demo-gateway 11000 自动装配类-微服务网关使用示例
simple-demo-encrypt 11110 自动装配类-注解字段加密脱敏使用示例
simple-demo-dict 11120 自动装配类-注解字段字典翻译使用示例
simple-demo-email 11130 自动装配类-邮件发送使用示例
simple-demo-package 11140 自动装配类-构建打包使用示例
demo-base-config 13010 服务类-基础参数使用示例
demo-base-generator 13020 服务类-代码生成使用示例
demo-base-s3 13030 服务类-文件管理使用示例
demo-base-dict 13040 服务类-字典管理使用示例

# Simple支持配置项

simple:
  ## simple-starter-web
  openApi:
    title: 接口文档示例
    description: 接口文档示例描述
    version: 1.0.0
    contact:
      name: ok1996
      url: https://ok96.cn
      email: git@ok96.cn
  handler:
    exception:
      #全局异常处理器 缺省项为true 
      enabled: true
  jackson:
    serialize:
      # 序列化格式转换 缺省项为true 
      enabled: true
  ## simple-starter-redisson
  redisson:
    #分布式锁 缺省项为false
    enabled: true
    type: standalone
    config:
      ## 单体模式
      standalone:
        address: redis://127.0.0.1:6379
        password:
        database: 0
      ## 主从模式
      masterSlave:
        masterAddress: redis://127.0.0.1:6379
        slaveAddresses:
          - redis://127.0.0.1:6379
        password:
        database: 0
      ## 哨兵配置
      sentinel:
        sentinelMasterName: myMaster
        sentinelAddresses:
          - redis://127.0.0.1:26379
          - redis://127.0.0.2:26379
        password:
        database: 0
      ## 集群方式
      cluster:
        clusterAddresses:
          - redis://127.0.0.1:7000
          - redis://127.0.0.1:7001
          - redis://127.0.0.2:7000
        password:
    #Cacheable注解自定义配置
    cacheable:
      #缺省项为false,优先级小于simple.redisson.enabled
      enabled: true
      config:
        #自定义cacheName及过期时间
        cacheExpiresAfterFiveMinutes:
          ttl: 300000
          maxIdleTime: 300000
        cacheExpiresAfterTenSecond:
          ttl: 10000
          maxIdleTime: 10000
  ## simple-starter-socketio
  socketio:
    #长链接通讯及集群 缺省项为false
    enabled: true
    port: 12010
    upgradeTimeout: 1000000
    pingTimeout: 6000000
    pingInterval: 25000
  ## simple-starter-s3
  s3:
    #文件存储管理 缺省项为true
    enabled: true
    accessKey: 3sZWX1PLuCYNqzMw
    secretKey: vuLhQbT9iK1EunaLGETtytMBjJTxoHpw
    endpoint: 127.0.0.1:9000
  ## simple-starter-grpc
  grpc:
    client:
      #Grpc客户端 缺省项为false 
      enabled: true
      #设置Grpc调用超时时间 缺省项为5000毫秒
      timeout: 5000
      channel:
        local-grpc-server:
          address: '127.0.0.1:12030'
    server:
      #Grpc服务端 缺省项为false 
      enabled: true
      port: 12030
  ## simple-starter-datasource
  datasource:
    #自动创建数据库 缺省项为true 
    autoCreateDatabase: true
    locations:
      ## 实现接口追加配置文件中mapper-locations属性 缺省项为true
      enabled: true
  ## simple-starter-freemarker
  freemarker:  
    resourceVoList:  
        # resourceHandler:访问的前缀 resourceLocations:真实路径
      - resourceHandler:  /layui/**
        resourceLocations:  classpath:/plugin/layui/
      - resourceHandler:  /Users/**
        resourceLocations:  file:/Users/
  ## simple-starter-encrypt
  encrypt:
    desensitized:
      ##脱敏 缺省项为true
      enabled: true
    rsa:
      ## 接口加密
      secureParams:
        ## 接口请求参数或返回参数Rsa加密解密 缺省项为true
        enabled: true
        ## URL查询参数的请求字段 例:https://ok96.cn/api?encryptedData=xxxxxxx
        urlField: encryptedData
		## 默认关闭全局使用Mapping注解接口加解密 缺省项为false
        all-controller:
          mapping:
            enabled: false
      ## 时间戳校验
      timestampValidation:
        ## 默认关闭校验校验时间戳 缺省项为false
        enabled: true
        ## 校验时间戳的差值 毫秒 默认5秒
        expiryMillis: 60000
      ## 公钥 
      publicKey: |
        MIIBIjAN....
        wQIDAQAB
      ## 私钥 
      privateKey: |
        MIIEvgIBAD...
        s3pFfsfHFj
  ## simple-starter-dist
  dict:
    ##字典 缺省项为true
    enabled: false
  ## simple-starter-email
  email:
    config:
      ##SMTP服务器host
      smtpHost:
      ##SMTP服务器端口号
      smtpPort:
      ##发件人邮箱用户名
      username:
      ##发件人邮箱密码
      password:
      ##发件人邮箱地址
      fromEmail:
  base:
    #simple-base-generator
    generator:
      project:
        # 初始化压缩包地址
        initProjectZipUrl: /temp/initProject.zip
        # 解压覆盖生成项目压缩包操作的临时目录
        newProjectAndZipTempPath: /temp/simple/new
  feign:
    # 开启日志记录,缺省默认开启
	# simple-starter-cloud
    logger:
      enabled: true
    base:
	  ## simple-base-config-service
      config:
        # 未开启注册中心需要指定调用地址
        url: http://localhost:9010
	  ## simple-base-s3-service
      s3:
        # 未开启注册中心需要指定调用地址
        url: http://localhost:9020
	  ## simple-base-dict-service
      dict:
        # 未开启注册中心需要指定调用地址
        url: http://localhost:9030
  scan:
    ## 关闭service依赖中service服务端,仅使用service依赖中的api客户端
	## simple-base-config-service simple-base-s3-service simple-base-dict-service
    service:
      enabled: false
logging:
  level:
    # 声明包位置的Feign日志级别为debug,打印日志详情
    cn:
      iosd: debug
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190

# 启动Service需修改的配置

  • Add VM options

# BaseConfigSpringbootApplication

必填

-Dspring.datasource.dynamic.datasource.master.url=jdbc:mysql://127.0.0.1:3306/simple_demo?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
-Dspring.datasource.dynamic.datasource.master.username=
-Dspring.datasource.dynamic.datasource.master.password=
1
2
3

可选

-Dspring.cloud.nacos.server-addr=http://127.0.0.1:8848
-Dspring.cloud.nacos.username=
-Dspring.cloud.nacos.password=
-Dspring.cloud.nacos.discovery.enabled=true
-Dspring.cloud.nacos.discovery.namespace=
-Dspring.cloud.nacos.config.enabled=true
-Dspring.cloud.nacos.config.namespace=
1
2
3
4
5
6
7

# BaseS3ServiceApplication

BaseS3ServiceApplication-必填

-Dsimple.s3.accessKey= 
-Dsimple.s3.secretKey= 
-Dsimple.s3.endpoint= 
1
2
3

BaseS3ServiceApplication-可选

-Dspring.cloud.nacos.server-addr=http://127.0.0.1:8848
-Dspring.cloud.nacos.username=
-Dspring.cloud.nacos.password=
-Dspring.cloud.nacos.discovery.enabled=true
-Dspring.cloud.nacos.discovery.namespace=
-Dspring.cloud.nacos.config.enabled=true
-Dspring.cloud.nacos.config.namespace=
1
2
3
4
5
6
7

# BaseDictServiceApplication

BaseDictServiceApplication-必填

-Dspring.datasource.dynamic.datasource.master.url=jdbc:mysql://127.0.0.1:3306/simple_demo?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
-Dspring.datasource.dynamic.datasource.master.username=
-Dspring.datasource.dynamic.datasource.master.password=
1
2
3

BaseDictServiceApplication-可选

-Dspring.cloud.nacos.server-addr=http://127.0.0.1:8848
-Dspring.cloud.nacos.username=
-Dspring.cloud.nacos.password=
-Dspring.cloud.nacos.discovery.enabled=true
-Dspring.cloud.nacos.discovery.namespace=
-Dspring.cloud.nacos.config.enabled=true
-Dspring.cloud.nacos.config.namespace=
1
2
3
4
5
6
7

# 启动Demo需修改的配置

  • Add VM options

DemoCloudApplication

-Dspring.cloud.nacos.server-addr=
-Dspring.cloud.nacos.username=nacos
-Dspring.cloud.nacos.password=
-Dspring.cloud.nacos.discovery.namespace=
-Dspring.cloud.nacos.config.namespace=
1
2
3
4
5

DemoGatewayApplication

-Dspring.cloud.nacos.server-addr=
-Dspring.cloud.nacos.username=nacos
-Dspring.cloud.nacos.password=
-Dspring.cloud.nacos.discovery.namespace=
-Dspring.cloud.nacos.config.namespace=
1
2
3
4
5

DemoDatasourceApplication

-Dspring.datasource.dynamic.datasource.master.url=
-Dspring.datasource.dynamic.datasource.master.username=root
-Dspring.datasource.dynamic.datasource.master.password=
1
2
3

DemoRedissonApplication

-Dsimple.redisson.config.standalone.address=
-Dsimple.redisson.config.standalone.password=
1
2

DemoS3Application

-Dsimple.s3.accessKey=
-Dsimple.s3.secretKey=
-Dsimple.s3.endpoint=
1
2
3

DemoSocketOneApplication

-Dsimple.redisson.config.standalone.address=
-Dsimple.redisson.config.standalone.password=
1
2

DemoSocketTwoApplication

-Dsimple.redisson.config.standalone.address=
-Dsimple.redisson.config.standalone.password=
1
2

DemoEmailApplication

-Dsimple.email.smtpHost=
-Dsimple.email.smtpPort=
-Dsimple.email.username=
-Dsimple.email.password=
-Dsimple.email.fromEmail=
1
2
3
4
5

BaseConfigApplication

-Dspring.datasource.dynamic.datasource.master.url=
-Dspring.datasource.dynamic.datasource.master.username=root
-Dspring.datasource.dynamic.datasource.master.password=
1
2
3

BaseGeneratorApplication

-Dspring.datasource.dynamic.datasource.master.url=
-Dspring.datasource.dynamic.datasource.master.username=root
-Dspring.datasource.dynamic.datasource.master.password=
1
2
3

BaseGeneratorTestApplication -修改代码

MybatisGeneratorVo.setDataBaseUrl()
MybatisGeneratorVo.setDataBaseUserName()
MybatisGeneratorVo.setDataBasePassword()
1
2
3

BaseS3Application

-Dsimple.s3.accessKey=
-Dsimple.s3.secretKey=
-Dsimple.s3.endpoint=
1
2
3

BaseDictApplication

-Dspring.datasource.dynamic.datasource.master.url=
-Dspring.datasource.dynamic.datasource.master.username=
-Dspring.datasource.dynamic.datasource.master.password=
1
2
3
上次更新: 2024/03/25, 02:28:08
simple-utils-jackson
simple-starter-web

← simple-utils-jackson simple-starter-web→

Copyright © 2019-2024
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式