# 核心模块
zc-core-spring-boot-starter
是zhengcheng
框架核心通用组件。
# 安装
<dependency>
<groupId>com.zhengcheng</groupId>
<artifactId>zc-core-spring-boot-starter</artifactId>
</dependency>
1
2
3
4
2
3
4
# 属性配置
server.port=${port:8080}
# 注意数据库URL中链接的配置参数(这里使用了主从配置方式)
spring.datasource.url=jdbc:mysql:replication://127.0.0.1:3306,127.0.0.1:3306/magic?characterEncoding=UTF-8&useSSL=false&autoReconnect=true&allowMasterDownConnections=true&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
spring.datasource.hikari.username=root
spring.datasource.hikari.password=root
spring.datasource.hikari.minimum-idle=2
spring.datasource.hikari.maximum-pool-size=10
spring.datasource.hikari.idle-timeout=60000
spring.datasource.hikari.max-lifetime=600000
spring.datasource.hikari.connection-timeout=30000
spring.datasource.hikari.connection-test-query=SELECT 1
spring.datasource.hikari.auto-commit=true
mybatis-plus.mapper-locations = classpath*:**/*Mapper.xml
mybatis-plus.type-aliases-package = com.zhengcheng.user.entity
mybatis-plus.configuration.map-underscore-to-camel-case = true
mybatis-plus.type-enums-package = com.zhengcheng.user.enums
spring.swagger.enable = true
spring.swagger.title = magic
spring.swagger.description = zhengcheng-parent magic
spring.swagger.license = Apache License, Version 2.0
spring.swagger.license-url = https://www.apache.org/licenses/LICENSE-2.0.html
spring.swagger.base-package = com.zhengcheng.magic.controller
spring.swagger.base-path = /**
spring.swagger.exclude-path = /error, /ops/**
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
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
# 核心功能
在zhengcheng
的SpringBoot
中,只需要引入此包即可,它包含了以下组件
- zc-mybatis-plus-spring-boot-starter
- zc-cache-spring-boot-starter
- zc-feign-spring-boot-starter
- zc-swagger-spring-boot-starter
核心组件通过 @RestControllerAdvice
+ @ExceptionHandler
的方式实现了全局统一异常处理,参考文档如下:
- ExceptionControllerAdvice
- Spring MVC Exceptions (opens new window)
- 有关 @ControllerAdvice 更多详细信息,请参见 javadoc。 (opens new window)