Commit 3d390d0d8f39affa3403a5d3edf533ce67365c38
1 parent
4d35bcef
feat: knife4j
Showing
8 changed files
with
44 additions
and
22 deletions
yudao-dependencies/pom.xml
| @@ -19,7 +19,7 @@ | @@ -19,7 +19,7 @@ | ||
| 19 | <spring.boot.version>2.7.7</spring.boot.version> | 19 | <spring.boot.version>2.7.7</spring.boot.version> |
| 20 | <!-- Web 相关 --> | 20 | <!-- Web 相关 --> |
| 21 | <springdoc.version>1.6.14</springdoc.version> | 21 | <springdoc.version>1.6.14</springdoc.version> |
| 22 | - <!-- <knife4j.version>4.0.0</knife4j.version>--> | 22 | + <knife4j.version>4.0.0</knife4j.version> |
| 23 | <servlet.versoin>2.5</servlet.versoin> | 23 | <servlet.versoin>2.5</servlet.versoin> |
| 24 | <!-- DB 相关 --> | 24 | <!-- DB 相关 --> |
| 25 | <druid.version>1.2.15</druid.version> | 25 | <druid.version>1.2.15</druid.version> |
| @@ -164,11 +164,11 @@ | @@ -164,11 +164,11 @@ | ||
| 164 | <version>${revision}</version> | 164 | <version>${revision}</version> |
| 165 | </dependency> | 165 | </dependency> |
| 166 | 166 | ||
| 167 | - <!-- <dependency>--> | ||
| 168 | - <!-- <groupId>com.github.xiaoymin</groupId>--> | ||
| 169 | - <!-- <artifactId>knife4j-openapi3-spring-boot-starter</artifactId>--> | ||
| 170 | - <!-- <version>${knife4j.version}</version>--> | ||
| 171 | - <!-- </dependency>--> | 167 | + <dependency> |
| 168 | + <groupId>com.github.xiaoymin</groupId> | ||
| 169 | + <artifactId>knife4j-openapi3-spring-boot-starter</artifactId> | ||
| 170 | + <version>${knife4j.version}</version> | ||
| 171 | + </dependency> | ||
| 172 | <dependency> | 172 | <dependency> |
| 173 | <groupId>org.springdoc</groupId> | 173 | <groupId>org.springdoc</groupId> |
| 174 | <artifactId>springdoc-openapi-ui</artifactId> | 174 | <artifactId>springdoc-openapi-ui</artifactId> |
yudao-framework/yudao-common/pom.xml
| @@ -58,10 +58,6 @@ | @@ -58,10 +58,6 @@ | ||
| 58 | <scope>provided</scope> <!-- 设置为 provided,只有工具类需要使用到 --> | 58 | <scope>provided</scope> <!-- 设置为 provided,只有工具类需要使用到 --> |
| 59 | </dependency> | 59 | </dependency> |
| 60 | 60 | ||
| 61 | -<!-- <dependency>--> | ||
| 62 | -<!-- <groupId>com.github.xiaoymin</groupId>--> | ||
| 63 | -<!-- <artifactId>knife4j-openapi3-spring-boot-starter</artifactId>--> | ||
| 64 | -<!-- </dependency>--> | ||
| 65 | <dependency> | 61 | <dependency> |
| 66 | <groupId>org.springdoc</groupId> | 62 | <groupId>org.springdoc</groupId> |
| 67 | <artifactId>springdoc-openapi-ui</artifactId> | 63 | <artifactId>springdoc-openapi-ui</artifactId> |
yudao-framework/yudao-spring-boot-starter-web/pom.xml
| @@ -33,10 +33,10 @@ | @@ -33,10 +33,10 @@ | ||
| 33 | <optional>true</optional> | 33 | <optional>true</optional> |
| 34 | </dependency> | 34 | </dependency> |
| 35 | 35 | ||
| 36 | -<!-- <dependency>--> | ||
| 37 | -<!-- <groupId>com.github.xiaoymin</groupId>--> | ||
| 38 | -<!-- <artifactId>knife4j-openapi3-spring-boot-starter</artifactId>--> | ||
| 39 | -<!-- </dependency>--> | 36 | + <dependency> |
| 37 | + <groupId>com.github.xiaoymin</groupId> | ||
| 38 | + <artifactId>knife4j-openapi3-spring-boot-starter</artifactId> | ||
| 39 | + </dependency> | ||
| 40 | <dependency> | 40 | <dependency> |
| 41 | <groupId>org.springdoc</groupId> | 41 | <groupId>org.springdoc</groupId> |
| 42 | <artifactId>springdoc-openapi-ui</artifactId> | 42 | <artifactId>springdoc-openapi-ui</artifactId> |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/swagger/config/SwaggerProperties.java
| @@ -39,5 +39,27 @@ public class SwaggerProperties { | @@ -39,5 +39,27 @@ public class SwaggerProperties { | ||
| 39 | */ | 39 | */ |
| 40 | @NotEmpty(message = "扫描的 package 不能为空") | 40 | @NotEmpty(message = "扫描的 package 不能为空") |
| 41 | private String basePackage; | 41 | private String basePackage; |
| 42 | + /** | ||
| 43 | + * url | ||
| 44 | + */ | ||
| 45 | + @NotEmpty(message = "扫描的 package 不能为空") | ||
| 46 | + private String url; | ||
| 47 | + /** | ||
| 48 | |||
| 49 | + */ | ||
| 50 | + @NotEmpty(message = "扫描的 email 不能为空") | ||
| 51 | + private String email; | ||
| 52 | + | ||
| 53 | + /** | ||
| 54 | + * license | ||
| 55 | + */ | ||
| 56 | + @NotEmpty(message = "扫描的 license 不能为空") | ||
| 57 | + private String license; | ||
| 58 | + | ||
| 59 | + /** | ||
| 60 | + * license-url | ||
| 61 | + */ | ||
| 62 | + @NotEmpty(message = "扫描的 license-url 不能为空") | ||
| 63 | + private String licenseUrl; | ||
| 42 | 64 | ||
| 43 | } | 65 | } |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/swagger/config/YudaoSwaggerAutoConfiguration.java
| @@ -44,8 +44,8 @@ public class YudaoSwaggerAutoConfiguration { | @@ -44,8 +44,8 @@ public class YudaoSwaggerAutoConfiguration { | ||
| 44 | .title(properties.getTitle()) | 44 | .title(properties.getTitle()) |
| 45 | .description(properties.getDescription()) | 45 | .description(properties.getDescription()) |
| 46 | .version(properties.getVersion()) | 46 | .version(properties.getVersion()) |
| 47 | - .contact(new Contact().name("xingyuv").url("xingyuv.com").email("xingyu4j@vip.qq.com")) | ||
| 48 | - .license(new License().name("MIT").url("https://gitee.com/zhijiantianya/ruoyi-vue-pro/blob/master/LICENSE")); | 47 | + .contact(new Contact().name(properties.getAuthor()).url(properties.getUrl()).email(properties.getEmail())) |
| 48 | + .license(new License().name(properties.getLicense()).url(properties.getLicenseUrl())); | ||
| 49 | return new OpenAPI() | 49 | return new OpenAPI() |
| 50 | .info(info) | 50 | .info(info) |
| 51 | .schemaRequirement(HttpHeaders.AUTHORIZATION, securityScheme()) | 51 | .schemaRequirement(HttpHeaders.AUTHORIZATION, securityScheme()) |
yudao-framework/yudao-spring-boot-starter-web/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
| 1 | cn.iocoder.yudao.framework.apilog.config.YudaoApiLogAutoConfiguration | 1 | cn.iocoder.yudao.framework.apilog.config.YudaoApiLogAutoConfiguration |
| 2 | cn.iocoder.yudao.framework.jackson.config.YudaoJacksonAutoConfiguration | 2 | cn.iocoder.yudao.framework.jackson.config.YudaoJacksonAutoConfiguration |
| 3 | +com.github.xiaoymin.knife4j.spring.configuration.Knife4jAutoConfiguration | ||
| 3 | cn.iocoder.yudao.framework.swagger.config.YudaoSwaggerAutoConfiguration | 4 | cn.iocoder.yudao.framework.swagger.config.YudaoSwaggerAutoConfiguration |
| 4 | cn.iocoder.yudao.framework.web.config.YudaoWebAutoConfiguration | 5 | cn.iocoder.yudao.framework.web.config.YudaoWebAutoConfiguration |
| 5 | \ No newline at end of file | 6 | \ No newline at end of file |
yudao-server/src/main/resources/application.yaml
| @@ -43,11 +43,10 @@ springdoc: | @@ -43,11 +43,10 @@ springdoc: | ||
| 43 | enabled: true | 43 | enabled: true |
| 44 | path: /v3/api-docs | 44 | path: /v3/api-docs |
| 45 | 45 | ||
| 46 | - | ||
| 47 | -#knife4j: | ||
| 48 | -# enable: true | ||
| 49 | -# setting: | ||
| 50 | -# language: zh_cn | 46 | +knife4j: |
| 47 | + enable: true | ||
| 48 | + setting: | ||
| 49 | + language: zh_cn | ||
| 51 | 50 | ||
| 52 | # 工作流 Flowable 配置 | 51 | # 工作流 Flowable 配置 |
| 53 | flowable: | 52 | flowable: |
| @@ -117,6 +116,10 @@ yudao: | @@ -117,6 +116,10 @@ yudao: | ||
| 117 | description: 提供管理员管理的所有功能 | 116 | description: 提供管理员管理的所有功能 |
| 118 | version: ${yudao.info.version} | 117 | version: ${yudao.info.version} |
| 119 | base-package: ${yudao.info.base-package} | 118 | base-package: ${yudao.info.base-package} |
| 119 | + url: ${yudao.web.admin-ui.url} | ||
| 120 | + email: xingyu4j@vip.qq.com | ||
| 121 | + license: MIT | ||
| 122 | + license-url: https://gitee.com/zhijiantianya/ruoyi-vue-pro/blob/master/LICENSE | ||
| 120 | captcha: | 123 | captcha: |
| 121 | enable: true # 验证码的开关,默认为 true | 124 | enable: true # 验证码的开关,默认为 true |
| 122 | codegen: | 125 | codegen: |
yudao-ui-admin-vue3/src/views/infra/swagger/index.vue
| @@ -8,5 +8,5 @@ import { ref } from 'vue' | @@ -8,5 +8,5 @@ import { ref } from 'vue' | ||
| 8 | import { IFrame } from '@/components/IFrame' | 8 | import { IFrame } from '@/components/IFrame' |
| 9 | 9 | ||
| 10 | const BASE_URL = import.meta.env.VITE_BASE_URL | 10 | const BASE_URL = import.meta.env.VITE_BASE_URL |
| 11 | -const src = ref(BASE_URL + '/swagger-ui') | 11 | +const src = ref(BASE_URL + '/doc.html') |
| 12 | </script> | 12 | </script> |