国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

springdoc-openapi-ui 整合 knife,多模塊分組,腳手架

這篇具有很好參考價值的文章主要介紹了springdoc-openapi-ui 整合 knife,多模塊分組,腳手架。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

?pom文件:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.7.2</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <groupId>com.example</groupId>
    <artifactId>demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>2023_demo</name>
    <description>2023_demo</description>

    <properties>
        <java.version>11</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springdoc</groupId>
            <artifactId>springdoc-openapi-ui</artifactId>
            <version>1.6.11</version>
        </dependency>
        <dependency>
            <groupId>com.github.xiaoymin</groupId>
            <artifactId>knife4j-springdoc-ui</artifactId>
            <version>3.0.3</version>
        </dependency>


    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                        </exclude>
                    </excludes>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <repositories>
        <repository>
            <id>aliyun-repo</id>
            <name>aliyun</name>
            <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
        </repository>
    </repositories>

</project>

yum文件:

server:
  port: 18080

springdoc:
  swagger-ui:
    enabled: true # 開關(guān)
    doc-expansion: none  #關(guān)閉展開
  api-docs:
    enabled: true # 開關(guān)

swagger配置文件

package com.example.demo.config;

import io.swagger.v3.oas.annotations.OpenAPIDefinition;
import io.swagger.v3.oas.annotations.info.Info;
import io.swagger.v3.oas.models.parameters.Parameter;
import org.springdoc.core.GroupedOpenApi;
import org.springdoc.core.customizers.OperationCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @description
 
 * @author 
 * @since 2023/8/31
 */
@Configuration
@OpenAPIDefinition(info = @Info(title = "springDoc + knife 集成測試", version = "1.0",
        description = "swagger基礎(chǔ)項目腳手架")
)
public class SwaggerConfig {

    @Bean
    public GroupedOpenApi usercApi() {
        return GroupedOpenApi.builder()
                .group("用戶管理")
                .packagesToScan("com.example.demo.system")
                .pathsToMatch("/**")
                .build();
    }

    @Bean
    public GroupedOpenApi biApi(OperationCustomizer operationCustomizer) {
        return GroupedOpenApi.builder()
                .group("報表管理")
                .packagesToScan("com.example.demo.bi")
                .pathsToMatch("/**")
                .addOperationCustomizer(operationCustomizer)
                .build();
    }

    @Bean
    public OperationCustomizer operationCustomizer() {
        return (operation, handlerMethod) -> operation.addParametersItem(
                new Parameter()
                        .in("header")
                        .required(true)
                        .description("token 驗證")
                        .name("token"));
    }

//    @Bean
//    public OpenApiCustomiser customerGlobalHeaderOpenApiCustomise() {
//        Parameter passwordParameter = new Parameter().name("password").description("密碼").in(ParameterIn.QUERY.toString()).schema(new Schema<>().type("string"));
//        Parameter usernameParameter = new Parameter().name("username").description("用戶名").in(ParameterIn.QUERY.toString()).schema(new Schema<>().type("string"));
//        ApiResponse apiResponse = new ApiResponse().content(new Content().addMediaType("*/*", new MediaType()));
//        PathItem pathItem = new PathItem().post(new Operation().summary("登錄").tags(CollUtil.newArrayList("system/auth")).description("系統(tǒng)管理/鑒權(quán)接口").responses(new ApiResponses()
//                        .addApiResponse("default", apiResponse))
//                .parameters(CollUtil.newArrayList(usernameParameter, passwordParameter)));
//        return openApi -> openApi.path("/auth/login", pathItem);
//
//    }
}

訪問swagger-ui:

springdoc-openapi-ui 整合 knife,多模塊分組,腳手架,ui

訪問doc.html:?http://localhost:18080/doc.html

springdoc-openapi-ui 整合 knife,多模塊分組,腳手架,ui文章來源地址http://www.zghlxwxcb.cn/news/detail-697541.html

到了這里,關(guān)于springdoc-openapi-ui 整合 knife,多模塊分組,腳手架的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權(quán),不承擔相關(guān)法律責任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實不符,請點擊違法舉報進行投訴反饋,一經(jīng)查實,立即刪除!

領(lǐng)支付寶紅包贊助服務器費用

相關(guān)文章

  • SpringBoot3中Swagger整合knife4j和springdoc的配置說明

    ? springboot3開始javax包改成了jakarta,而swagger-oas等包中依然使用的是javax所以報錯。另外springfox已經(jīng)過時了,兩年沒更新了,并且不支持OpenAPI3 標準,而SpringBoot3只支持OpenAPI3規(guī)范,所以要遷移到springdoc Knife4J是一款基于Swagger快速生成API文檔和調(diào)試平臺的開源工具,它可以輕松地

    2024年02月04日
    瀏覽(33)
  • Springboot3.0.0+集成SpringDoc并配置knife4j的UI

    環(huán)境:JDK17,Springboot3+,springdoc2+,knife4j 4+ Springdoc本身也是集成了Swagger3,而knife4j美化了Swagger3的UI Knife4j官網(wǎng): 快速開始 | Knife4j Springdoc官網(wǎng) OpenAPI 3 Library for spring-boot 由于此knife4j內(nèi)依賴了SpringDoc,因此不用另外引入springdoc的依賴 springdoc依賴(無需引入),親測引入也不會沖突

    2024年02月09日
    瀏覽(29)
  • Spring Boot 3.x 引入springdoc-openapi (內(nèi)置Swagger UI、webmvc-api)

    Spring Boot 3.x 引入springdoc-openapi (內(nèi)置Swagger UI、webmvc-api)

    接觸的原因 因開發(fā)自己的項目時,寫接口文檔很繁瑣,查到后端都在用 swagger 等接口工具來記錄接口文檔,于是學習了一下,本文記錄個人配置過程,有問題歡迎指正交流?? Swagger: Swagger是一種Rest API的表示方式,它是標準的、語言無關(guān)的工具,這種表示方式不僅人可讀,

    2024年04月27日
    瀏覽(20)
  • Spring Doc OpenAPI3.0 拋棄SpringFox擁抱SpringDoc

    Spring Doc OpenAPI3.0 拋棄SpringFox擁抱SpringDoc

    SpringDoc是SpringBoot 的API文檔工具。官網(wǎng):https://springdoc.org/ 在使用SpringBoot 2.6以前去創(chuàng)建API文檔工具一般會采用 SpringFox 提供的Swagger庫,但是由于SpringBoot版本的不斷升級和SpringFox擺爛不更新,導致了SpringBoot2.6之后的項目無法使用SpringFox去生成API文檔,或者可以使用但是有很多

    2024年02月04日
    瀏覽(19)
  • @Tag和@Operation標簽失效問題。SpringDoc 2.2.0(OpenApi 3)和Spring Boot 3.1.1集成

    @Tag和@Operation標簽失效問題。SpringDoc 2.2.0(OpenApi 3)和Spring Boot 3.1.1集成

    問題 @Tag和@Operation標簽失效 但是@Schema標簽有效 pom依賴 debug排查,發(fā)現(xiàn)時國際化問題 解決方法:application.yml配置禁用i18n翻譯

    2024年02月05日
    瀏覽(23)
  • Spring Boot3.x 使用SpringDoc生成接口文檔-超級完善 + knife4jUI

    Spring Boot3.x 使用SpringDoc生成接口文檔-超級完善 + knife4jUI

    在Springfox3.0停更的兩年里,SpringBoot進入3.0時代, SpringFox出現(xiàn)越來越多的問題,最為明顯的就是解析器的問題,已經(jīng)在上文 中解釋清楚,這里就不再贅述。 SpringDoc是Spring官方推薦的API,相信不會輕易停更。 SpringDoc有多個版本,如果你使用的是SpringBoot3.x,請確保SpringDoc的版本

    2024年02月04日
    瀏覽(16)
  • springboot3.0.11-SNAPSHOT使用knife4j-openapi3所遇見的問題

    springboot3.0.11-SNAPSHOT使用knife4j-openapi3所遇見的問題

    ide2021 jdk17 springboot3.0.11-SNAPSHOT 在使用springboot3寫完一個項目后,想快速生成一篇接口文檔,供自己觀看。在網(wǎng)上沖浪一段時間后,發(fā)現(xiàn)使用Swagger文檔比較合適,通過少量的注解來完成一篇復雜的文檔。說干就干,直接cope網(wǎng)上的資料寫一個demo來用,發(fā)現(xiàn)項目無法正常啟動。在

    2024年02月04日
    瀏覽(24)
  • Springboot3.0整合swagger,廢棄Springfox改用Springdoc

    Springboot3.0整合swagger,廢棄Springfox改用Springdoc

    Automated JSON API documentation for API\\\'s built with Spring 官網(wǎng)地址:springfox.io springdoc-openapi java library helps to automate the generation of API documentation using spring boot projects. 官網(wǎng)地址:https://springdoc.org/v2/ 注意 :使用的是V2版本,這個版本支持springboot3.0 之前springboot3.0之前我用的都是Springfox來集

    2023年04月09日
    瀏覽(23)
  • SpringBoot3整合OpenAPI3(Swagger3)

    SpringBoot3整合OpenAPI3(Swagger3)

    swagger2 更新到3后,再使用方法上發(fā)生了很大的變化,名稱也變?yōu)?OpenAPI3 。 官方文檔 openapi3 使用十分方便,做到這里后,你可以直接通過以下網(wǎng)址訪問 swagger 頁面。 1. @OpenAPIDefinition + @Info 用于定義整個 API 的信息,通常放在主應用類上??梢园?API 的標題、描述、版本等信

    2024年01月22日
    瀏覽(21)
  • 【微信公眾號】15、SpringBoot整合WxJava實現(xiàn)openApi管理

    1、清空api的調(diào)用quota 本接口用于清空公眾號/小程序/第三方平臺等接口的每日調(diào)用接口次數(shù) 注意事項: 如果要清空公眾號的接口的quota,則需要用公眾號的access_token;如果要清空小程序的接口的quota,則需要用小程序的access_token;如果要清空第三方平臺的接口的quota,則需要

    2024年02月16日
    瀏覽(21)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包