SpringBoot使用Gateway聚合Springdoc,Knife4j

Nacos+Gateway+Springdoc 集中管理API Spring cloud Gateway 基于使用 Netty 作为内嵌服务器,而 Netty 基于 WebFlux 实现,因此如果想要 springdoc 的 Swagger UI 显示在网关微服务中,需要用到它的 WebFlux UI 库。 阅读详情

SpringBoot使用Gateway聚合Springdoc,Knife4j

前言

同时支持springboot:3.0,springboot:2.0,使用gateway聚合springdoc,ui使用knife4j,解决由于nginx配置代理前缀导致的文档无法访问,不强依赖注册中心(nacos,zk,Eureka)

有帮助的话记得点个赞哟!!!

基础环境

将所有依赖集成好作为一个本地包供其他项目使用

  • jdk17
  • maven3.6+
  • springboot3.0+|springboot2.0+
  • springcloud:2022.0.1
  • springcloud-alibaba:1.8.1-2022.0.0-RC2
  • springdoc:2.0.2|springdoc:1.6.0+
  • knife4j:4.0.0

当使用springboot:3.0,请使用 springdoc:2.0.0+
当使用springboot:2.0,请使用 springdoc:1.6.0+(部分springdoc的包名替换即可)

工具包(framework-document)

依赖

<dependencies>
    <dependency>
        <groupId>org.springdoc</groupId>
        <artifactId>springdoc-openapi-starter-webmvc-api</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.springdoc</groupId>
        <artifactId>springdoc-openapi-starter-webflux-api</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-gateway</artifactId>
        <scope>provided</scope>
    </dependency>
</dependencies>

代码

文档信息properties
import com.github.mpcloud.framework.core.consts.Constant;
import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * The type Swagger properties.
 *
 * @author : Milo
 */
@ConfigurationProperties("springdoc.info")
public class DocumentInfoProperties {
    private static final String DEFAULT_OPEN_API_ROUTE_NAME = "open-api-route";
    private static final String DEFAULT_GATEWAY_API_ROUTE_NAME = "open-api-gateway-route";
    /**
     * 文档标题
     */
    private String title;
    /**
     * 文档描述
     */
    private String description;
    /**
     * 项目version
     */
    private String projectVersion;
    /**
     * 许可证
     */
    private String license;
    /**
     * 许可证URL
     */
    private String licenseUrl;
    /**
     * 项目负责人信息
     */
    private final Contact contact = new Contact();
    /**
     * gateway
     */
    private final Gateway gateway = new Gateway();

    public String getTitle() {
        return this.title;
    }

    public void setTitle(final String title) {
        this.title = title;
    }

    public String getDescription() {
        return this.description;
    }

    public void setDescription(final String description) {
        this.description = description;
    }

    public String getProjectVersion() {
        return this.projectVersion;
    }

    public void setProjectVersion(final String projectVersion) {
        this.projectVersion = projectVersion;
    }

    public String getLicense() {
        return this.license;
    }

    public void setLicense(final String license) {
        this.license = license;
    }

    public String getLicenseUrl() {
        return this.licenseUrl;
    }

    public void setLicenseUrl(final String licenseUrl) {
        this.licenseUrl = licenseUrl;
    }

    public Contact getContact() {
        return this.contact;
    }

    public Gateway getGateway() {
        return gateway;
    }

    public static class Contact {
        /**
         * 联系人
         **/
        private String name;
        /**
         * 联系人url
         **/
        private String url;
        /**
         * 联系人email
         **/
        private String email;

        public String getName() {
            return this.name;
        }

        public void setName(final String name) {
            this.name = name;
        }

        public String getUrl() {
            return this.url;
        }

        public void setUrl(final String url) {
            this.url = url;
        }

        public String getEmail() {
            return this.email;
        }

        public void setEmail(final String email) {
            this.email = email;
        }
    }

    public static class Gateway {
        /**
         * api 前缀
         */
        private String apiPathPrefix = Constant.URL_PREFIX;
        /**
         * 接口文档路由名称
         */
        private String openApiRouteName = DEFAULT_OPEN_API_ROUTE_NAME;
        /**
         * 网关接口文档路由名称
         */
        private String openApiGatewayApiRouteName = DEFAULT_GATEWAY_API_ROUTE_NAME;

        public String getApiPathPrefix() {
            return apiPathPrefix;
        }

        public void setApiPathPrefix(String apiPathPrefix) {
            this.apiPathPrefix = apiPathPrefix;
        }

        public String getOpenApiRouteName() {
            return openApiRouteName;
        }

        public void setOpenApiRouteName(String openApiRouteName) {
            this.openApiRouteName = openApiRouteName;
        }

        public String getOpenApiGatewayApiRouteName() {
            return openApiGatewayApiRouteName;
        }

        public void setOpenApiGatewayApiRouteName(String openApiGatewayApiRouteName) {
            this.openApiGatewayApiRouteName = openApiGatewayApiRouteName;
        }
    }
}
文档信息Configuration
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author milo
 */
@Configuration(proxyBeanMethods = false)
@EnableConfigurationProperties(DocumentInfoProperties.class)
@ConditionalOnProperty(name = "springdoc.api-docs.enabled", havingValue = "true")
@ConditionalOnWebApplication
public class DocumentConfiguration {
    @Bean
    public OpenAPI openApi(final DocumentInfoProperties docInfo) {
        return new OpenAPI().info(new Info()
            .title(docInfo.getTitle())
            .description(docInfo.getDescription())
            .version(docInfo.getProjectVersion())
            .contact(new Contact().name(docInfo.getContact().getName()).email(docInfo.getContact().getEmail()).url(docInfo.getContact().getUrl()))
            .license(new License().name(docInfo.getLicense()).url(docInfo.getLicenseUrl()))
        );
    }
}
解决Nginx代理导致的接口前缀问题

解决代理导致的接口文档请求不了的问题
如果nginx配置的以下内容,则需要如下类解决这个问题.

		location /api{
			proxy_pass http://localhost:8080;
			rewrite "^/api/(.*)$" /$1 break;
			proxy_set_header Host $host:$server_port;
		}

复写原有地址前缀

import com.github.mpcloud.framework.core.utils.PathUtils;
import org.springdoc.core.properties.SpringDocConfigProperties;
import org.springdoc.webflux.core.providers.SpringWebFluxProvider;

/**
 * @author : Milo
 */
public class CustomizeSpringWebFluxProvider extends SpringWebFluxProvider {
    @Override
    public String findPathPrefix(SpringDocConfigProperties springDocConfigProperties) {
        DocumentInfoProperties documentInfoProperties = applicationContext.getBean(DocumentInfoProperties.class);
        return PathUtils.append(documentInfoProperties.getGateway().getApiPathPrefix() + super.findPathPrefix(springDocConfigProperties));
    }
}
网关与SpringDoc整合的配置类

import com.github.mpcloud.framework.core.consts.Constant;
import com.github.mpcloud.framework.core.utils.PathUtils;
import com.github.mpcloud.framework.core.utils.spring.SpringContextHolder;
import org.springdoc.core.properties.AbstractSwaggerUiConfigProperties.SwaggerUrl;
import org.springdoc.core.properties.SpringDocConfigProperties;
import org.springdoc.core.properties.SwaggerUiConfigParameters;
import org.springdoc.core.providers.SpringWebProvider;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.cloud.client.discovery.event.HeartbeatEvent;
import org.springframework.cloud.client.serviceregistry.Registration;
import org.springframework.cloud.gateway.event.RefreshRoutesEvent;
import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.event.EventListener;

import java.util.List;

import static org.springdoc.core.utils.Constants.SPRINGDOC_ENABLED;
import static org.springdoc.core.utils.Constants.SPRINGDOC_SWAGGER_UI_ENABLED;
import static org.springframework.util.AntPathMatcher.DEFAULT_PATH_SEPARATOR;

/**
 * @author : Milo
 */
@Configuration
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.REACTIVE)
@ConditionalOnProperty(name = { SPRINGDOC_ENABLED, SPRINGDOC_SWAGGER_UI_ENABLED }, matchIfMissing = true, havingValue = "true")
public class GatewayRouterGroupProviderConfiguration {
    private final DiscoveryClient discoveryClient;
    private final SpringDocConfigProperties springDocConfig;
    private final DocumentInfoProperties documentInfo;
    private final SwaggerUiConfigParameters swaggerUiConfig;

    public GatewayRouterGroupProviderConfiguration(DiscoveryClient discoveryClient, SpringDocConfigProperties springDocConfig, DocumentInfoProperties documentInfo, SwaggerUiConfigParameters swaggerUiConfig) {
        this.discoveryClient = discoveryClient;
        this.springDocConfig = springDocConfig;
        this.documentInfo = documentInfo;
        this.swaggerUiConfig = swaggerUiConfig;
    }

    /**
     * openapi 路由(重写服务名所在位置)
     *
     * @param builder 路由构造器
     *
     * @return 路由
     */
    @Bean
    public RouteLocator openApiRouteLocator(final RouteLocatorBuilder builder) {
        return builder.routes()
            .route(this.documentInfo.getGateway().getOpenApiRouteName(), route -> route
                .path(this.springDocConfig.getApiDocs().getPath() + "/**")
                .filters(filter -> filter.rewritePath(this.springDocConfig.getApiDocs().getPath() + "/(?<segment>.*)", "/$\{segment}" + this.springDocConfig.getApiDocs().getPath()))
                .uri(Constant.HTTP_PREFIX + "localhost:" + SpringContextHolder.getServerPort())
            )
            .build();
    }

    /**
     * 网关当前路由 (去掉服务名)
     *
     * @param builder 路由构造器
     *
     * @return 路由
     */
    @Bean
    public RouteLocator registrationRouteLocator(Registration registration, final RouteLocatorBuilder builder) {
        return builder.routes()
            .route(this.documentInfo.getGateway().getOpenApiRouteName(), route -> route
                .path(DEFAULT_PATH_SEPARATOR + registration.getServiceId() + "/**")
                .filters(filter -> filter.rewritePath(DEFAULT_PATH_SEPARATOR + registration.getServiceId() + "/(?<segment>.*)", "/$\{segment}"))
                .uri(Constant.HTTP_PREFIX + "localhost:" + SpringContextHolder.getServerPort())
            )
            .build();
    }

    /**
     * Spring web provider spring web provider.
     *
     * @return the spring web provider
     */
    @Bean
    SpringWebProvider springWebProvider() {
        return new SpringGatewayProvider();
    }

    @EventListener(classes = { ApplicationReadyEvent.class, HeartbeatEvent.class, RefreshRoutesEvent.class })
    public synchronized void discover() {
        List<SwaggerUrl> swaggerUrls = this.discoveryClient.getServices()
            .stream()
            .map(instance -> {
                final SwaggerUrl swaggerUrl = new SwaggerUrl();
                swaggerUrl.setName(instance);
                swaggerUrl.setDisplayName(instance);
                swaggerUrl.setUrl(PathUtils.append(this.documentInfo.getGateway().getApiPathPrefix(), this.springDocConfig.getApiDocs().getPath(), instance));
                return swaggerUrl;
            })
            .toList();
        swaggerUiConfig.getUrls().clear();
        swaggerUiConfig.getUrls().addAll(swaggerUrls);
    }
}

使用工具包

gateway中使用

依赖
<dependencies>
    <!--上面的步骤所构建的包(这个是我本地的,请替换为自己写的)-->
    <dependency>
        <groupId>com.github.mpcloud</groupId>
        <artifactId>framework-document</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-gateway</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-loadbalancer</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>
    <dependency>
        <groupId>com.github.ben-manes.caffeine</groupId>
        <artifactId>caffeine</artifactId>
    </dependency>
    <dependency>
        <groupId>com.alibaba.cloud</groupId>
        <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
    </dependency>
    <dependency>
        <groupId>com.alibaba.cloud</groupId>
        <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
    </dependency>
    <dependency>
        <groupId>com.alibaba.nacos</groupId>
        <artifactId>nacos-client</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-bootstrap</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springdoc</groupId>
        <artifactId>springdoc-openapi-starter-webflux-ui</artifactId>
    </dependency>
    <dependency>
        <groupId>com.github.xiaoymin</groupId>
        <artifactId>knife4j-openapi3-ui</artifactId>
    </dependency>
</dependencies>
配置
server:
  port: 8080
spring:
  application:
    name: mpcloud-gateway
  cloud:
    nacos:
      username: nacos
      password: nacos
      discovery:
        server-addr: localhost:8848
        namespace: mpcloud
        cluster-name: shanghai
        heart-beat-timeout: 40000
        heart-beat-interval: 20000
        ip-delete-timeout: 80000
      config:
        server-addr: localhost:8848
        namespace: mpcloud
        timeout: 3000
        file-extension: yml
    gateway:
      discovery:
        locator:
          enabled: true
          lower-case-service-id: true
      globalcors:
        cors-configurations:
          '[/**]':
            allowedHeaders: '*'
            allowedMethods: '*'
            allowedOrigins: '*'
      httpclient:
        connect-timeout: 2000
        response-timeout: 60s
  main:
    banner-mode: off
  webflux:
    multipart:
      file-storage-directory: /tmp
      max-in-memory-size: 12MB
    format:
      date-time: yyyy-MM-dd HH:mm:ss
      date: yyyy-MM-dd
      time: HH:mm:ss
springdoc:
  api-docs:
    enabled: true
    groups:
      enabled: true
    path: /v3/api-docs
  swagger-ui:
    enabled: true
  info:
    title: 网关Api文档
    description: 网关Api文档
    project-version: 0.0.1
    license: https://milo-xiaomeng.github.io
    license-url: https://milo-xiaomeng.github.io
    contact:
      name: milo
      url: http://localhost:8080
      email: milo.xiaomeng@gmail.com
    gateway:
      # 如果Nginx设置了代理路径前缀,则此处位置必须为对应前缀 如果没有前缀,可以不设置或者为 /
      # 如Nginx如下配置
      # location /api{
      #   proxy_pass http://localhost:8080;
      #   rewrite "^/api/(.*)$" /$1 break;
      #   proxy_set_header Host $host:$server_port;
      # }
      api-path-prefix: /api
  show-actuator: true

web服务中使用

依赖
dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>com.alibaba.cloud</groupId>
        <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
    </dependency>
    <dependency>
        <groupId>com.alibaba.cloud</groupId>
        <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
    </dependency>
    <dependency>
        <groupId>com.alibaba.nacos</groupId>
        <artifactId>nacos-client</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-bootstrap</artifactId>
    </dependency>
    <!--上面的步骤所构建的包(这个是我本地的,请替换为自己写的)-->
    <dependency>
        <groupId>com.github.mpcloud</groupId>
        <artifactId>framework-document</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springdoc</groupId>
        <artifactId>springdoc-openapi-starter-webmvc-api</artifactId>
    </dependency>
</dependencies>
配置
server:
  port: 8083
spring:
  application:
    name: mpcloud-monitoring
  profiles:
    active: dev
  cloud:
    nacos:
      username: nacos
      password: nacos
      discovery:
        server-addr: localhost:8848
        namespace: mpcloud
        cluster-name: shanghai
      config:
        server-addr: localhost:8848
        namespace: mpcloud
        timeout: 3000
        file-extension: yml
springdoc:
  api-docs:
    enabled: true
    groups:
      enabled: true
    path: /v3/api-docs
  info:
    title: 监控Api文档
    description: 监控Api文档
    project-version: 0.0.1
    license: mpcloud.github.com
    license-url: mpcloud.github.com
    contact:
      name: milo
      url: http://localhost:8080
      email: milo.xiaomeng@gmail.com
  show-actuator: true

效果

image.png

具体代码地址

gitee代码地址

我的博客

优快云地址

掘金地址

网关Gateway(3.0.1)入门:配置、过滤器、分布式限流 Spring Cloud Gateway(3.0.1) This project provides an API Gateway built on top of the Spring Ecosystem, including: Spring 5, Spring Boot 2 and Project Reactor. Spring Cloud Gateway aims to provide a simple, yet effective way to route to APIs and provide cro 阅读详情

相关推荐

SpringCloud2022.x集成springDoc v2.x

NacosNacosspringDocspringboot升级为3.x时,swagger的迁移会出现一些问题,目前springboot3.x将 包javax下的所有内容都迁移到了jakarta下,比如HttpServletRequest, 而swagger还是使用的包javax, 导致出现不兼容的问题,因此可以使用springdoc来替代以前的swagger包。注意:本次使用的SpringDoc版本为2.X对应的OpenAPI 3,如果使用1.x。

BadBoyxiaolin的博客 1112

【超详细】springboot + springdoc-openapi + knife4j 集成案例

java库有助于使用 spring boot 项目自动生成 API 文档。springdoc-openapi通过在运行时检查应用程序以根据 spring 配置、类结构和各种注释推断 API 语义来工作。自动生成 JSON/YAML 和 HTML 格式 API 的文档。可以使用 swagger-api 注释通过注释来完成此文档。该库支持:OpenAPI3Swagger-uiOAuth 2GraalVM 原生镜像Knife4j是一个集Swagger2和OpenAPI3为一体的增强解决方案。

BASK2312的博客 9361

SpringBoot入门到精通-三步整合knife4j

knife4j的比较好看 Knife4j的前身是swagger-bootstrap-ui,前身swagger-bootstrap-ui是一个纯swagger-ui的ui皮肤项目 一开始项目初衷是为了写一个增强版本的swagger的前端ui,但是随着项目的发展,面对越来越多的个性化需求,不得不编写后端Java代码以满足新的需求,在swagger-bootstrap-ui的1.8.5~1.9.6版本之间,采用的是后端Java代码和Ui都混合在一个Jar包里面的方式提供给开发者使用.这种方式虽说对于集成swa

隔壁老瓦的专栏 5995

springdoc+knife4j

添加group分组。

学长的猫的博客 3604

【漆学军】MT4进阶到MT5速成之路(2)获取持仓

MT5在持仓获取上,要比MT4复杂些,分两部分,获取持仓和挂单采用了不同的方法。 一、获取持仓中的buy和sell单 int b=0;//获取buy单个数 int s=0;//获取sell单个数 double lot_total_buy=0;//获取持仓中buy单的总手数 double lot_total_sell=0;//获取持仓中sell单的总手数 for(int i=0; i<PositionsTotal(); i++) { ulong ticket=Positi

漆学军的编程笔记 1625

Excel转LaTeX表格神器:excel2latex.xla插件使用全攻略(含下载链接与配置教程)

本文详细介绍了Excel转LaTeX表格神器excel2latex.xla插件的完整使用攻略。从下载安装、基础转换到高级配置,深入讲解了如何利用该插件高效生成LaTeX代码,特别针对IEEE双栏等复杂排版需求提供了专业解决方案,帮助用户彻底告别手动编码,提升学术与专业文档的排版效率。

app77的博客 295

SpringBoot 3.5 集成 Knife4j 4.3 步骤

《微服务架构下Knife4j的API文档解决方案》摘要: 本文系统介绍了基于SpringBoot3.5和SpringCloudGateway的Knife4j集成方案。核心内容包括:1)微服务API文档三层次架构(规范层/生成层/展示层)的协作关系;2)Knife4j作为Swagger增强方案的核心功能,包括自动生成文档、在线调试和离线导出;3)详细集成步骤,涵盖JDK17环境配置、SpringDoc注解规范、YAML文件设置;4)特别提供了SpringCloudGateway下的两种聚合方案:服务发现模式

tonight_precious的博客 482

VMware vCenter 6.7证书过期急救指南:从503报错到完美修复的全流程

本文详细解析了VMware vCenter 6.7因STS证书过期导致503报错的根本原因,并提供了一套从诊断到修复的完整实战流程。内容包括使用checksts.py脚本检测STS证书状态,通过fixsts.sh脚本更新证书,以及利用Certificate-Manager全面重置所有过期证书,帮助管理员快速恢复服务并避免常见陷阱。

weixin_29234239的博客 772

Spring Cloud Gateway 网关整合 Knife4j 4.3 实现微服务接口文档聚合

本文介绍了如何通过整合 Knife4j 4.3 和 Spring Cloud,以及利用 Spring Cloud Gateway 网关聚合各个服务的接口文档,实现对 youlai-mall 新版本的接口文档统一管理。同时,通过接口文档测试 Spring Authorization Server 的自定义扩展的 OAuth2 密码模式的认证授权流程。

有来技术 1万+

Transformer实战(38)——视觉Transformer (Vision Transformer, ViT)

Transformer 在自然语言处理 (NLP) 领域取得了显著成就,在许多不同的任务中都表现出色。在本节中,我们将探索视觉 Transformer (Vision Transformer, ViT) 模型。正如 NLP 领域创建了多种模型一样,视觉领域也开发了多种模型,每种模型都为计算机视觉提供了新的视角。通过本节,将学习如何使用 ViT 等模型进行计算机视觉任务,了解基于 Transformer 的预训练计算机视觉模型的工作原理,以及如何针对特定任务进行微调。

盼小辉丶的博客 2886

PCL 三维重建 基于B样条曲线的曲面重建算法

本文将介绍如何使用B样条曲线进行三维点云数据的曲面重建。B样条曲线和曲面是一种强大的数学工具,在计算机图形学、CAD设计等领域中广泛应用。通过对点云数据进行曲面拟合和优化,最终得到精确的曲面模型。本示例展示了如何利用PCL中的B样条曲线拟合算法进行三维曲面重建,并对重建结果进行可视化。

纵马踏花向自由 658

18. knife4j 接口文档

本文介绍了如何在Spring Boot应用中使用Knife4j这一API文档在线查看工具,并通过配置Gateway实现了API接口聚合。 使用Knife4j可以方便地生成API接口文档,提高开发效率以及降低开发成本。而聚合接口可以使得我们可以统一管理不同服务的API文档,便于开发人员查阅和使用。

小虎哥的技术博客 513

C#项目实战——【实例】企业人事管理系统(二):4、数据库与数据表设计;5、创建项目;

(1)展开新建的db_PWMS数据库节点,选中“表”节点,单击鼠标右键,在弹出的快捷菜单中选择“新建表”命令,如下图:(2)在SQL Server 2008管理器的右边显示一个新表,这里输入要创建的表中所需要的字段,并设置主键,如下图:(3)单击“保存”按钮,弹出“选择名称”对话框,如下图,输入要新建的表名“tb_Login”,单击“确定”按钮,即可在数据库中添加一个表。

做有价值的事,积累有价值的笔记! 1621

SpringCloud项目集成Knife4j

SpringCloud项目集成Knife4j

happyyGoo的博客 1236

linux那些事之numa balance

numa balance numa balance是页迁移技术最重要也是最开始使用应用的技术,主要是为解决由于调度器进程在两个node迁移造成访问内存性能问题。 numba balance通过页迁移技术,将不在运行节点的内存迁移到所运行的节点上。对应numa balance要注意几点: 防止进程在两个节点之前来回切换造成频繁进行页迁移(ping pang现场)从而影响性能。numa balance本身就是为了提高性能,不能因为造成频繁页迁移而对性能进行一个反向优化。 多个线程分布在不同线程 访.

weixin_42730667的博客 3908

使用 FastAPI 和 LangGraph 构建生产级智能体 AI 系统

这是一本关于使用 FastAPI 和 LangGraph 构建生产级智能体 AI 系统的详细书籍,全文约 10 万字。《Production-Grade Agentic AI System Design and Implementation: Building Agentic AI Systems Using FastAPI and LangGraph》随着人工智能(AI)技术的迅猛发展,智能体(Agent)作为能够自主感知、推理、决策和行动的实体,正逐渐成为构建复杂智能系统的核心。从个性化推荐、客户服务到

AI天才研究院 348

和swagger_springcloudgateway聚合swagger文档

需求背景spring cloud搭建微服务系统,每个业务模块使用swagger开放文档接口查询,在业务网关模块提供swagger文档聚合查询接口,可以通过选择业务模块分类查看。框架选型、版本及主要功能spring boot 2.1.6.RELEASEspring cloud Greenwich.SR3spring cloud gateway 2.1.3.RELEASE 网关组件knife...

weixin_42386504的博客 171

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

Spring Boot 3集成Knife4j:替代Swagger2的API文档解决方案

API文档工具是现代软件开发中不可或缺的组成部分,它基于OpenAPI规范实现接口描述标准化。相比已停止维护的Swagger2,Knife4j作为国产开源项目持续迭代,特别针对Spring Boot 3做了全面适配。其核心价值在于提供增强的UI界面和调试功能,支持x-www-form-urlencoded和multipart/form-data格式测试,大幅提升前后端协作效率。在微服务架构下,Knife4j还能通过网关实现文档聚合,满足企业级项目的需求。本文以Spring Boot 3.1.5为例,详解Kn

weixin_30367169的博客 387

Outlook Express 6 (OE6) for Win7/Win8/Win10

英文版 Outlook Express6.0, 兼容Win7/Win10/WinXP,解压就可用。

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

JP4-1-1-MyLesson项目简介

MyLesson项目简介,包括项目介绍,权限介绍,环境介绍,技术栈介绍,环境初始化操作,数据库表的创建等。

周航宇的博客 2965

锂电池充电器电路设计 里面有电路

锂电池充电器电路设计 里面有电路 3.7V升压到5V电路设计。

springdoc与spring cloud gateway整合经验分享

分享一次springdoc与spring cloud gateway整合的经验。

翼望空间@youkuaiyun.com 6125

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

springboot3开始javax包改成了jakarta,而swagger-oas等包中依然使用的是javax所以报错。另外springfox已经过时了,两年没更新了,并且不支持OpenAPI3 标准,而SpringBoot3只支持OpenAPI3规范,所以要迁移到springdocKnife4J是一款基于Swagger快速生成API文档和调试平台的开源工具,它可以轻松地将Swagger规范转换成易于阅读的文档,并支持在线测试API。

m0_74055560的博客 1万+

【Spring实战】31 Spring Boot3 集成 Gateway 微服务网关

Spring Cloud Gateway 是一个基于 Spring Framework 的开源网关服务,用于构建微服务架构中的 API 网关。它提供了一种灵活的方式来路由请求、过滤请求以及对请求进行各种操作,从而实现对微服务的集中控制、安全性、监控等功能。Spring Cloud Gateway 提供了一个强大而灵活的工具,用于构建微服务架构中的 API 网关。通过合理配置,你可以实现路由、过滤、负载均衡等功能,为微服务架构提供了更好的可维护性和可扩展性。

好久不见的流星 6884

Knife4j的使用、SpringFox和SpringDoc介绍

既然是一个增强工具,那么原先Swagger中怎么写的,依然怎么写,knife4j不会做出改变。Swagger的生成的默认文档确实不好用(不美观、不支持搜索、不能导出)knife4j是一个Swagger的增强工具,能够完善项目的接口文档。只需要在原先Swagger的基础上,引入knif4j的依赖即可。只是最后生成的文档更强大、漂亮了。

这是我的笔记本,记录学习历程,分享学习经验,菜鸡一枚,感谢支持! 2462

springcloud3 GateWay章节-Eureka+gateway动态路由负载均衡1

gateway相当于所有服务的门户,将客户端请求与服务端应用相分离,客户端请求通过gateway后由定义的路由和断言进行转发,路由代表需要转发请求的地址,断言相当于请求这些地址时所满足的条件,只有同时符合路由和断言才给予转发gateway根据路由与断言去转发请求到指定的服务。

健康平安的活着的专栏 6273

Spring Cloud Gateway集成SpringDoc,集中管理微服务API

本文目标为Spring Cloud微服务集成SpringDoc,在Spring Cloud Gateway中统一管理微服务的API,微服务上下线时自动刷新SwaggerUi中的group组。

云逸的博客 3624

SpringBoot整合knife4j(快速入门超详细版)

在日常开发中,写接口文档是我们必不可少的,而Knife4j就是一个接口文档工具,可以看作是Swagger的升级版,但是界面比Swagger更好看,功能更丰富早期,swagger-boostrap-ui是1.x版本,如今swagger-bootsrap-ui到2.x,同时也更改名字Knife4j,适用于单体和微服务项目。怎么样,是不是特别的方便和简单~

weixin_47316183的博客 4万+
上一篇: SpringBoot获取配置文件属性值
下一篇: EasyExcel使用Validator进行读取校验,批量处理数据,返回处理异常的行以及列
陈年_风褛
博客等级 码龄8年 7粉丝 3原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值