首页
  • 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概述
    • 自动装配模块

      • simple-starter-web
        • 简介
        • 引入依赖
        • 配置项
        • 功能项
          • 全局异常处理器
          • 序列化格式转换
          • 通用响应信息主体
          • 接口文档
          • 访问路径
          • 关闭SwaggerUi
          • 关闭 /v3/api-docs endpoint
          • SpringDoc文档
      • simple-starter-redisson
      • simple-starter-s3
      • simple-starter-socketio
      • simple-starter-grpc
      • simple-starter-datasource
      • simple-starter-freemarker
      • simple-starter-cloud
      • simple-starter-encrypt
      • simple-starter-dict
      • simple-starter-email
      • simple-starter-gateway
      • simple-starter-package
    • 服务类模块

    • 工具类模块

  • 2024.1.1.1

  • 2024.1.1.0

  • OpenSource
  • 2024.1.2.0
  • 自动装配模块
xiaoku
2023-03-31
目录

simple-starter-web

# 简介

集成SpringBoot Web和接口文档、时间类型的序列化格式转换
定义通用的响应信息主体、全局异常处理器、Jackson工具类

# 引入依赖

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

# 配置项

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
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

# 功能项

# 全局异常处理器

拦截列表

  • Exception.class
  • RuntimeException.class
  • HttpRequestMethodNotSupportedException.class

# 序列化格式转换

  • 将LocalTime类型转换为Long
  • 将LocalDate类型转换为Long
  • 将LocalDateTime类型转换为Long

# 通用响应信息主体

实体类名称:Response 返回格式:

{
	"code": 0,
	"msg": "",
	"data": {

	}
}
1
2
3
4
5
6
7

# 接口文档

依赖:Springdoc+knife4j ui

# 访问路径

  • host:port/swagger-ui/index.html
  • host:port/doc.html

# 关闭SwaggerUi

springdoc:
  swagger-ui:
    enabled: false
1
2
3

# 关闭 /v3/api-docs endpoint

springdoc:
  apiDocs:
    enabled: false
1
2
3

# SpringDoc文档

Springdoc (opens new window)

上次更新: 2024/03/25, 02:28:08
Simple-Starter概述
simple-starter-redisson

← Simple-Starter概述 simple-starter-redisson→

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