Skip to content

Commit 23084a4

Browse files
committed
fix: 规范 yaml 配置格式
1 parent c21c7be commit 23084a4

3 files changed

Lines changed: 26 additions & 35 deletions

File tree

Lines changed: 23 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,42 @@
1+
server:
2+
port: 8000
3+
4+
# spring config
15
spring:
26
application:
37
name: simple-admin
48
jackson:
59
date-format: yyyy-MM-dd HH:mm:ss
610
time-zone: GMT+8
711

8-
# 端口
9-
server:
10-
port: 8000
11-
12-
# 配置 mybatis
12+
# mybatis config
1313
mybatis:
1414
mapper-locations: classpath*:mapper/**/*.xml
1515
type-aliases-package: top.cadecode
1616
configuration:
1717
map-underscore-to-camel-case: true
1818

19-
# 自定义配置
20-
simple:
21-
datasource:
22-
dbs:
23-
db1:
24-
# 数据源类型
25-
type: com.zaxxer.hikari.HikariDataSource
26-
# 是否设置为默认数据源
27-
default-flag: true
28-
# 数据源配置,根据 type 而定
29-
config:
30-
jdbc-url: jdbc:mysql://localhost:3306/demo?useSSL=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
31-
driver-class-name: com.mysql.cj.jdbc.Driver
32-
username: root
33-
password: xxxx
34-
db2:
35-
type: com.zaxxer.hikari.HikariDataSource
36-
config:
37-
jdbc-url: jdbc:mysql://localhost:3306/demo_cluster?useSSL=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
38-
driver-class-name: com.mysql.cj.jdbc.Driver
39-
username: root
40-
password: xxxx
19+
# custom config
20+
custom:
21+
dbs:
22+
db1:
23+
type: com.zaxxer.hikari.HikariDataSource
24+
default-flag: true
25+
config:
26+
jdbc-url: jdbc:mysql://localhost:3306/demo?useSSL=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
27+
driver-class-name: com.mysql.cj.jdbc.Driver
28+
username: root
29+
password: xxxx
30+
db2:
31+
type: com.zaxxer.hikari.HikariDataSource
32+
config:
33+
jdbc-url: jdbc:mysql://localhost:3306/demo_cluster?useSSL=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
34+
driver-class-name: com.mysql.cj.jdbc.Driver
35+
username: root
36+
password: xxxx
4137
jwt:
42-
# token 请求头
4338
header: token
44-
# refresh token 请求头
4539
refresh-header: refresh-token
46-
# token 过期时间
4740
expiration: 86400
48-
# refresh token 过期时间
4941
refresh-expiration: 86400
50-
# 密钥
5142
secret: 12345678123456781234567812345678

simple-common/src/main/java/top/cadecode/common/util/TokenUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
*/
2626
@Data
2727
@Component
28-
@ConfigurationProperties(prefix = "simple.jwt")
28+
@ConfigurationProperties(prefix = "custom.jwt")
2929
public class TokenUtil {
3030

3131
private String header;

simple-framework/src/main/java/top/cadecode/framework/config/DataSourceConfig.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727
@Data
2828
@RequiredArgsConstructor
2929
@Configuration
30-
@ConfigurationProperties("simple.datasource")
30+
@ConfigurationProperties("custom")
3131
public class DataSourceConfig {
3232

33-
private static final String DBS_PREFIX = "simple.datasource.dbs.";
33+
private static final String DBS_PREFIX = "custom.dbs.";
3434
private static final String DBS_SUFFIX = ".config";
3535

3636
private final Environment environment;

0 commit comments

Comments
 (0)