feat: knife4j

pull/2/head
xingyu 2023-01-17 20:42:18 +08:00
parent 4d35bcef65
commit 3d390d0d8f
8 changed files with 44 additions and 22 deletions

View File

@ -19,7 +19,7 @@
<spring.boot.version>2.7.7</spring.boot.version> <spring.boot.version>2.7.7</spring.boot.version>
<!-- Web 相关 --> <!-- Web 相关 -->
<springdoc.version>1.6.14</springdoc.version> <springdoc.version>1.6.14</springdoc.version>
<!-- <knife4j.version>4.0.0</knife4j.version>--> <knife4j.version>4.0.0</knife4j.version>
<servlet.versoin>2.5</servlet.versoin> <servlet.versoin>2.5</servlet.versoin>
<!-- DB 相关 --> <!-- DB 相关 -->
<druid.version>1.2.15</druid.version> <druid.version>1.2.15</druid.version>
@ -164,11 +164,11 @@
<version>${revision}</version> <version>${revision}</version>
</dependency> </dependency>
<!-- <dependency>--> <dependency>
<!-- <groupId>com.github.xiaoymin</groupId>--> <groupId>com.github.xiaoymin</groupId>
<!-- <artifactId>knife4j-openapi3-spring-boot-starter</artifactId>--> <artifactId>knife4j-openapi3-spring-boot-starter</artifactId>
<!-- <version>${knife4j.version}</version>--> <version>${knife4j.version}</version>
<!-- </dependency>--> </dependency>
<dependency> <dependency>
<groupId>org.springdoc</groupId> <groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId> <artifactId>springdoc-openapi-ui</artifactId>

View File

@ -58,10 +58,6 @@
<scope>provided</scope> <!-- 设置为 provided只有工具类需要使用到 --> <scope>provided</scope> <!-- 设置为 provided只有工具类需要使用到 -->
</dependency> </dependency>
<!-- <dependency>-->
<!-- <groupId>com.github.xiaoymin</groupId>-->
<!-- <artifactId>knife4j-openapi3-spring-boot-starter</artifactId>-->
<!-- </dependency>-->
<dependency> <dependency>
<groupId>org.springdoc</groupId> <groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId> <artifactId>springdoc-openapi-ui</artifactId>

View File

@ -33,10 +33,10 @@
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<!-- <dependency>--> <dependency>
<!-- <groupId>com.github.xiaoymin</groupId>--> <groupId>com.github.xiaoymin</groupId>
<!-- <artifactId>knife4j-openapi3-spring-boot-starter</artifactId>--> <artifactId>knife4j-openapi3-spring-boot-starter</artifactId>
<!-- </dependency>--> </dependency>
<dependency> <dependency>
<groupId>org.springdoc</groupId> <groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId> <artifactId>springdoc-openapi-ui</artifactId>

View File

@ -39,5 +39,27 @@ public class SwaggerProperties {
*/ */
@NotEmpty(message = "扫描的 package 不能为空") @NotEmpty(message = "扫描的 package 不能为空")
private String basePackage; private String basePackage;
/**
* url
*/
@NotEmpty(message = "扫描的 package 不能为空")
private String url;
/**
* email
*/
@NotEmpty(message = "扫描的 email 不能为空")
private String email;
/**
* license
*/
@NotEmpty(message = "扫描的 license 不能为空")
private String license;
/**
* license-url
*/
@NotEmpty(message = "扫描的 license-url 不能为空")
private String licenseUrl;
} }

View File

@ -44,8 +44,8 @@ public class YudaoSwaggerAutoConfiguration {
.title(properties.getTitle()) .title(properties.getTitle())
.description(properties.getDescription()) .description(properties.getDescription())
.version(properties.getVersion()) .version(properties.getVersion())
.contact(new Contact().name("xingyuv").url("xingyuv.com").email("xingyu4j@vip.qq.com")) .contact(new Contact().name(properties.getAuthor()).url(properties.getUrl()).email(properties.getEmail()))
.license(new License().name("MIT").url("https://gitee.com/zhijiantianya/ruoyi-vue-pro/blob/master/LICENSE")); .license(new License().name(properties.getLicense()).url(properties.getLicenseUrl()));
return new OpenAPI() return new OpenAPI()
.info(info) .info(info)
.schemaRequirement(HttpHeaders.AUTHORIZATION, securityScheme()) .schemaRequirement(HttpHeaders.AUTHORIZATION, securityScheme())

View File

@ -1,4 +1,5 @@
cn.iocoder.yudao.framework.apilog.config.YudaoApiLogAutoConfiguration cn.iocoder.yudao.framework.apilog.config.YudaoApiLogAutoConfiguration
cn.iocoder.yudao.framework.jackson.config.YudaoJacksonAutoConfiguration cn.iocoder.yudao.framework.jackson.config.YudaoJacksonAutoConfiguration
com.github.xiaoymin.knife4j.spring.configuration.Knife4jAutoConfiguration
cn.iocoder.yudao.framework.swagger.config.YudaoSwaggerAutoConfiguration cn.iocoder.yudao.framework.swagger.config.YudaoSwaggerAutoConfiguration
cn.iocoder.yudao.framework.web.config.YudaoWebAutoConfiguration cn.iocoder.yudao.framework.web.config.YudaoWebAutoConfiguration

View File

@ -43,11 +43,10 @@ springdoc:
enabled: true enabled: true
path: /v3/api-docs path: /v3/api-docs
knife4j:
#knife4j: enable: true
# enable: true setting:
# setting: language: zh_cn
# language: zh_cn
# 工作流 Flowable 配置 # 工作流 Flowable 配置
flowable: flowable:
@ -117,6 +116,10 @@ yudao:
description: 提供管理员管理的所有功能 description: 提供管理员管理的所有功能
version: ${yudao.info.version} version: ${yudao.info.version}
base-package: ${yudao.info.base-package} base-package: ${yudao.info.base-package}
url: ${yudao.web.admin-ui.url}
email: xingyu4j@vip.qq.com
license: MIT
license-url: https://gitee.com/zhijiantianya/ruoyi-vue-pro/blob/master/LICENSE
captcha: captcha:
enable: true # 验证码的开关,默认为 true enable: true # 验证码的开关,默认为 true
codegen: codegen:

View File

@ -8,5 +8,5 @@ import { ref } from 'vue'
import { IFrame } from '@/components/IFrame' import { IFrame } from '@/components/IFrame'
const BASE_URL = import.meta.env.VITE_BASE_URL const BASE_URL = import.meta.env.VITE_BASE_URL
const src = ref(BASE_URL + '/swagger-ui') const src = ref(BASE_URL + '/doc.html')
</script> </script>