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 | 19 | <spring.boot.version>2.7.7</spring.boot.version> |
| 20 | 20 | <!-- Web 相关 --> |
| 21 | 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 | 23 | <servlet.versoin>2.5</servlet.versoin> |
| 24 | 24 | <!-- DB 相关 --> |
| 25 | 25 | <druid.version>1.2.15</druid.version> |
| ... | ... | @@ -164,11 +164,11 @@ |
| 164 | 164 | <version>${revision}</version> |
| 165 | 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 | 172 | <dependency> |
| 173 | 173 | <groupId>org.springdoc</groupId> |
| 174 | 174 | <artifactId>springdoc-openapi-ui</artifactId> | ... | ... |
yudao-framework/yudao-common/pom.xml
| ... | ... | @@ -58,10 +58,6 @@ |
| 58 | 58 | <scope>provided</scope> <!-- 设置为 provided,只有工具类需要使用到 --> |
| 59 | 59 | </dependency> |
| 60 | 60 | |
| 61 | -<!-- <dependency>--> | |
| 62 | -<!-- <groupId>com.github.xiaoymin</groupId>--> | |
| 63 | -<!-- <artifactId>knife4j-openapi3-spring-boot-starter</artifactId>--> | |
| 64 | -<!-- </dependency>--> | |
| 65 | 61 | <dependency> |
| 66 | 62 | <groupId>org.springdoc</groupId> |
| 67 | 63 | <artifactId>springdoc-openapi-ui</artifactId> | ... | ... |
yudao-framework/yudao-spring-boot-starter-web/pom.xml
| ... | ... | @@ -33,10 +33,10 @@ |
| 33 | 33 | <optional>true</optional> |
| 34 | 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 | 40 | <dependency> |
| 41 | 41 | <groupId>org.springdoc</groupId> |
| 42 | 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 | 39 | */ |
| 40 | 40 | @NotEmpty(message = "扫描的 package 不能为空") |
| 41 | 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 | 44 | .title(properties.getTitle()) |
| 45 | 45 | .description(properties.getDescription()) |
| 46 | 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 | 49 | return new OpenAPI() |
| 50 | 50 | .info(info) |
| 51 | 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 | 1 | cn.iocoder.yudao.framework.apilog.config.YudaoApiLogAutoConfiguration |
| 2 | 2 | cn.iocoder.yudao.framework.jackson.config.YudaoJacksonAutoConfiguration |
| 3 | +com.github.xiaoymin.knife4j.spring.configuration.Knife4jAutoConfiguration | |
| 3 | 4 | cn.iocoder.yudao.framework.swagger.config.YudaoSwaggerAutoConfiguration |
| 4 | 5 | cn.iocoder.yudao.framework.web.config.YudaoWebAutoConfiguration |
| 5 | 6 | \ No newline at end of file | ... | ... |
yudao-server/src/main/resources/application.yaml
| ... | ... | @@ -43,11 +43,10 @@ springdoc: |
| 43 | 43 | enabled: true |
| 44 | 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 | 51 | # 工作流 Flowable 配置 |
| 53 | 52 | flowable: |
| ... | ... | @@ -117,6 +116,10 @@ yudao: |
| 117 | 116 | description: 提供管理员管理的所有功能 |
| 118 | 117 | version: ${yudao.info.version} |
| 119 | 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 | 123 | captcha: |
| 121 | 124 | enable: true # 验证码的开关,默认为 true |
| 122 | 125 | codegen: | ... | ... |
yudao-ui-admin-vue3/src/views/infra/swagger/index.vue